Enum Class LineEnding

java.lang.Object
java.lang.Enum<LineEnding>
com.diffplug.spotless.LineEnding
All Implemented Interfaces:
Serializable, Comparable<LineEnding>, Constable

public enum LineEnding extends Enum<LineEnding>
Represents the line endings which should be written by the tool.
  • Enum Constant Details

    • GIT_ATTRIBUTES

      public static final LineEnding GIT_ATTRIBUTES
      Uses the same line endings as Git, using .gitattributes and the core.eol property.
    • GIT_ATTRIBUTES_FAST_ALLSAME

      public static final LineEnding GIT_ATTRIBUTES_FAST_ALLSAME
      Uses the same line endings as Git, and assumes that every single file being formatted will have the same line ending.
    • 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
    • MAC_CLASSIC

      public static final LineEnding MAC_CLASSIC
      \r
    • PRESERVE

      public static final LineEnding PRESERVE
      preserve the line ending of the first line (no matter which format)
  • Method Details

    • values

      public static LineEnding[] 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

      public static LineEnding valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • createPolicy

      public LineEnding.Policy createPolicy(File projectDir, Supplier<Iterable<File>> toFormat)
      Returns a LineEnding.Policy appropriate for files which are contained within the given rootFolder.
    • createPolicy

      public LineEnding.Policy createPolicy()
      Should use createPolicy(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. Use FileSignature.machineIsWin() instead.
      See Also:
    • str

      public String str()
      Returns the standard line ending for this policy.
    • toUnix

      public static String toUnix(String input)
      Returns a string with exclusively unix line endings.