Enum 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 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 the core.eol property.
      MAC_CLASSIC
      \r
      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 use createPolicy(File, Supplier) instead, but this will work iff its a path-independent LineEnding policy.
      LineEnding.Policy createPolicy​(java.io.File projectDir, java.util.function.Supplier<java.lang.Iterable<java.io.File>> toFormat)
      Returns a LineEnding.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.
      java.lang.String str()
      Returns the standard line ending for this policy.
      static java.lang.String toUnix​(java.lang.String input)
      Returns a string with exclusively unix line endings.
      static LineEnding valueOf​(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.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • GIT_ATTRIBUTES

        public static final LineEnding GIT_ATTRIBUTES
        Uses the same line endings as Git, using .gitattributes and the core.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
      • 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 name
        java.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 a LineEnding.Policy appropriate for files which are contained within the given rootFolder.
      • 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.