Package com.diffplug.spotless
Enum LineEnding
- java.lang.Object
-
- java.lang.Enum<LineEnding>
-
- com.diffplug.spotless.LineEnding
-
- All Implemented Interfaces:
Serializable
,Comparable<LineEnding>
public enum LineEnding extends Enum<LineEnding>
Represents the line endings which should be written by the tool.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
LineEnding.Policy
A policy for line endings which can vary based on the specific file being requested.
-
Enum Constant Summary
Enum Constants Enum Constant Description GIT_ATTRIBUTES
Uses the same line endings as Git, using.gitattributes
and thecore.eol
property.PLATFORM_NATIVE
\n
on unix systems,\r\n
on windows systems.UNIX
\n
WINDOWS
\r\n
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description LineEnding.Policy
createPolicy()
Should usecreatePolicy(File, Supplier)
instead, but this will work iff its a path-independent LineEnding policy.LineEnding.Policy
createPolicy(File projectDir, Supplier<Iterable<File>> toFormat)
Returns aLineEnding.Policy
appropriate for files which are contained within the given rootFolder.static boolean
nativeIsWin()
Deprecated.Using the system-native line endings to detect the windows operating system has turned out to be unreliable.String
str()
Returns the standard line ending for this policy.static String
toUnix(String input)
Returns a string with exclusively unix line endings.static LineEnding
valueOf(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.gitattributes
and thecore.eol
property.
-
PLATFORM_NATIVE
public static final LineEnding PLATFORM_NATIVE
\n
on unix systems,\r\n
on windows systems.
-
WINDOWS
public static final LineEnding WINDOWS
\r\n
-
UNIX
public static final LineEnding UNIX
\n
-
-
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(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
-
createPolicy
public LineEnding.Policy createPolicy(File projectDir, Supplier<Iterable<File>> toFormat)
Returns aLineEnding.Policy
appropriate 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 String str()
Returns the standard line ending for this policy.
-
-