Package com.google.gerrit.server.patch
Enum GitPositionTransformer.BestPositionOnConflict
- java.lang.Object
-
- java.lang.Enum<GitPositionTransformer.BestPositionOnConflict>
-
- com.google.gerrit.server.patch.GitPositionTransformer.BestPositionOnConflict
-
- All Implemented Interfaces:
GitPositionTransformer.PositionConflictStrategy
,Serializable
,Comparable<GitPositionTransformer.BestPositionOnConflict>
- Enclosing class:
- GitPositionTransformer
public static enum GitPositionTransformer.BestPositionOnConflict extends Enum<GitPositionTransformer.BestPositionOnConflict> implements GitPositionTransformer.PositionConflictStrategy
A strategy which tries to select the next suitableGitPositionTransformer.Position
on a conflicting mapping. At the moment, this strategy is very basic and only defers to the next higher level (e.g. range unclear -> drop range but keep file reference). This could be improved in the future.We need this strategy for ported comments.
Warning: With this strategy, mapped
GitPositionTransformer.Position
s are not guaranteed to refer to exactly the same commit content as before. See more details atGitPositionTransformer.PositionConflictStrategy
.Contract: This strategy will never drop any
GitPositionTransformer.Position
.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<GitPositionTransformer.Position>
getOnFileConflict(GitPositionTransformer.Position oldPosition)
Determines an alternateGitPositionTransformer.Position
when there is no file for the position (= file deletion) in the target tree.Optional<GitPositionTransformer.Position>
getOnRangeConflict(GitPositionTransformer.Position oldPosition)
Determines an alternateGitPositionTransformer.Position
when the range of the position can't be mapped without a conflict.static GitPositionTransformer.BestPositionOnConflict
valueOf(String name)
Returns the enum constant of this type with the specified name.static GitPositionTransformer.BestPositionOnConflict[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final GitPositionTransformer.BestPositionOnConflict INSTANCE
-
-
Method Detail
-
values
public static GitPositionTransformer.BestPositionOnConflict[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (GitPositionTransformer.BestPositionOnConflict c : GitPositionTransformer.BestPositionOnConflict.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static GitPositionTransformer.BestPositionOnConflict valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getOnRangeConflict
public Optional<GitPositionTransformer.Position> getOnRangeConflict(GitPositionTransformer.Position oldPosition)
Description copied from interface:GitPositionTransformer.PositionConflictStrategy
Determines an alternateGitPositionTransformer.Position
when the range of the position can't be mapped without a conflict.- Specified by:
getOnRangeConflict
in interfaceGitPositionTransformer.PositionConflictStrategy
- Parameters:
oldPosition
- position in the source tree- Returns:
- the new
GitPositionTransformer.Position
or an emptyOptional
if the position should be dropped
-
getOnFileConflict
public Optional<GitPositionTransformer.Position> getOnFileConflict(GitPositionTransformer.Position oldPosition)
Description copied from interface:GitPositionTransformer.PositionConflictStrategy
Determines an alternateGitPositionTransformer.Position
when there is no file for the position (= file deletion) in the target tree.- Specified by:
getOnFileConflict
in interfaceGitPositionTransformer.PositionConflictStrategy
- Parameters:
oldPosition
- position in the source tree- Returns:
- the new
GitPositionTransformer.Position
or an emptyOptional
if the position should be * dropped
-
-