Package com.diffplug.spotless
Enum LineEnding
- java.lang.Object
-
- java.lang.Enum<LineEnding>
-
- com.diffplug.spotless.LineEnding
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<LineEnding>
public enum LineEnding extends java.lang.Enum<LineEnding>
Represents the line endings which should be written by the tool.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceLineEnding.PolicyA policy for line endings which can vary based on the specific file being requested.
-
Enum Constant Summary
Enum Constants Enum Constant Description GIT_ATTRIBUTESUses the same line endings as Git, using.gitattributesand thecore.eolproperty.MAC_CLASSIC\rPLATFORM_NATIVE\non unix systems,\r\non windows systems.UNIX\nWINDOWS\r\n
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description LineEnding.PolicycreatePolicy()Should usecreatePolicy(File, Supplier)instead, but this will work iff its a path-independent LineEnding policy.LineEnding.PolicycreatePolicy(java.io.File projectDir, java.util.function.Supplier<java.lang.Iterable<java.io.File>> toFormat)Returns aLineEnding.Policyappropriate for files which are contained within the given rootFolder.static booleannativeIsWin()Deprecated.Using the system-native line endings to detect the windows operating system has turned out to be unreliable.java.lang.Stringstr()Returns the standard line ending for this policy.static java.lang.StringtoUnix(java.lang.String input)Returns a string with exclusively unix line endings.static LineEndingvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static LineEnding[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
GIT_ATTRIBUTES
public static final LineEnding GIT_ATTRIBUTES
Uses the same line endings as Git, using.gitattributesand thecore.eolproperty.
-
PLATFORM_NATIVE
public static final LineEnding PLATFORM_NATIVE
\non unix systems,\r\non windows systems.
-
WINDOWS
public static final LineEnding WINDOWS
\r\n
-
UNIX
public static final LineEnding UNIX
\n
-
MAC_CLASSIC
public static final LineEnding MAC_CLASSIC
\r
-
-
Method Detail
-
values
public static LineEnding[] 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 (LineEnding c : LineEnding.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static LineEnding valueOf(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
createPolicy
public LineEnding.Policy createPolicy(java.io.File projectDir, java.util.function.Supplier<java.lang.Iterable<java.io.File>> toFormat)
Returns aLineEnding.Policyappropriate for files which are contained within the given rootFolder.
-
createPolicy
public LineEnding.Policy createPolicy()
Should usecreatePolicy(File, Supplier)instead, but this will work iff its a path-independent LineEnding policy.
-
nativeIsWin
@Deprecated public static boolean nativeIsWin()
Deprecated.Using the system-native line endings to detect the windows operating system has turned out to be unreliable. UseFileSignature.machineIsWin()instead.- See Also:
FileSignature.machineIsWin()
-
str
public java.lang.String str()
Returns the standard line ending for this policy.
-
toUnix
public static java.lang.String toUnix(java.lang.String input)
Returns a string with exclusively unix line endings.
-
-