Package com.google.gerrit.server.patch
Enum Class 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>
,java.lang.constant.Constable
- Enclosing class:
- GitPositionTransformer
public static enum GitPositionTransformer.BestPositionOnConflict
extends Enum<GitPositionTransformer.BestPositionOnConflict>
implements GitPositionTransformer.PositionConflictStrategy
A strategy which tries to select the next suitable
GitPositionTransformer.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 at GitPositionTransformer.PositionConflictStrategy
.
Contract: This strategy will never drop any GitPositionTransformer.Position
.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptiongetOnFileConflict
(GitPositionTransformer.Position oldPosition) Determines an alternateGitPositionTransformer.Position
when there is no file for the position (= file deletion) in the target tree.getOnRangeConflict
(GitPositionTransformer.Position oldPosition) Determines an alternateGitPositionTransformer.Position
when the range of the position can't be mapped without a conflict.Returns the enum constant of this class with the specified name.values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class 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
-