Enum Class GitDiffSegmentType
- All Implemented Interfaces:
Serializable,Comparable<GitDiffSegmentType>,Constable
A
git-specific extension of the general DiffSegmentType enumeration bound more tightly to standard
diff core output.-
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 TypeMethodDescriptiondropPrefix(String line) Trims the prefix from the provided line.static GitDiffSegmentTypeExamines the provided line to determine its segment type.Retrieves the prefix which identifies this segment type.com.atlassian.bitbucket.content.DiffSegmentTypegetType()Retrieves the generalDiffSegmentTypefor thisgitsegment type.booleanisValid()static GitDiffSegmentTypeReturns the enum constant of this class with the specified name.static GitDiffSegmentType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ADDED
A leading plus marks an added line. -
COMMENT
A leading backslash marks observationsgitoffers about files it diffs. For example,
Note the space after the slash, which is included as part of this prefix.\ No newline at end of file -
CONTEXT
A leading space marks a context line. -
REMOVED
A leading hyphen marks a removed line.
-
-
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
-
forLine
Examines the provided line to determine its segment type. If the line does not start with a known prefix,nullis returned (to indicate the line does not belong to a segment).- Parameters:
line- the line to examine- Returns:
- the matching segment type, or
null
-
dropPrefix
Trims the prefix from the provided line. This helper function allows prefixes to be different lengths, which supports theCOMMENTtype.- Parameters:
line- the line to trim- Returns:
- the trimmed line
-
getPrefix
Retrieves the prefix which identifies this segment type.- Returns:
- the prefix
-
getType
public com.atlassian.bitbucket.content.DiffSegmentType getType()Retrieves the generalDiffSegmentTypefor thisgitsegment type.- Returns:
- the associated general segment type
-
isValid
public boolean isValid()
-