Class Formatter

java.lang.Object
com.diffplug.spotless.Formatter
All Implemented Interfaces:
Serializable, AutoCloseable

public final class Formatter extends Object implements Serializable, AutoCloseable
Formatter which performs the full formatting.
See Also:
  • Field Details

    • NO_FILE_SENTINEL

      public static final File NO_FILE_SENTINEL
      This Sentinel reference may be used to pass string content to a Formatter or FormatterStep when there is no actual File to format
  • Method Details

    • getLineEndingsPolicy

      public LineEnding.Policy getLineEndingsPolicy()
    • getEncoding

      public Charset getEncoding()
    • getSteps

      public List<FormatterStep> getSteps()
    • builder

      public static Formatter.Builder builder()
    • computeLineEndings

      public String computeLineEndings(String unix, File file)
      Applies the appropriate line endings to the given unix content.
    • compute

      public String compute(String unix, File file)
      Returns the result of calling all of the FormatterSteps. The input must have unix line endings, and the output is guaranteed to also have unix line endings.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable