public final class Formatter
extends java.lang.Object
implements java.io.Serializable, java.lang.AutoCloseable
Formatter which performs the full formatting.
| Modifier and Type | Class and Description |
|---|---|
static class |
Formatter.Builder |
| Modifier and Type | Method and Description |
|---|---|
void |
applyTo(java.io.File file)
Applies formatting to the given file.
|
java.lang.String |
applyToAndReturnResultIfDirty(java.io.File file)
Applies formatting to the given file.
|
static Formatter.Builder |
builder() |
void |
close() |
java.lang.String |
compute(java.lang.String unix,
java.io.File file)
Returns the result of calling all of the FormatterSteps.
|
java.lang.String |
computeLineEndings(java.lang.String unix,
java.io.File file)
Applies the appropriate line endings to the given unix content.
|
boolean |
equals(java.lang.Object obj) |
java.nio.charset.Charset |
getEncoding() |
LineEnding.Policy |
getLineEndingsPolicy() |
java.nio.file.Path |
getRootDir() |
java.util.List<FormatterStep> |
getSteps() |
int |
hashCode() |
boolean |
isClean(java.io.File file)
Returns true iff the given file’s formatting is up-to-date.
|
public LineEnding.Policy getLineEndingsPolicy()
public java.nio.charset.Charset getEncoding()
public java.nio.file.Path getRootDir()
public java.util.List<FormatterStep> getSteps()
public static Formatter.Builder builder()
public boolean isClean(java.io.File file)
throws java.io.IOException
Returns true iff the given file’s formatting is up-to-date.
java.io.IOExceptionpublic void applyTo(java.io.File file)
throws java.io.IOException
Applies formatting to the given file.
java.io.IOException@Nullable
public java.lang.String applyToAndReturnResultIfDirty(java.io.File file)
throws java.io.IOException
Applies formatting to the given file.
Returns null if the file was already clean, or the formatted result with unix newlines if it was not.
java.io.IOExceptionpublic java.lang.String computeLineEndings(java.lang.String unix,
java.io.File file)
Applies the appropriate line endings to the given unix content.
public java.lang.String compute(java.lang.String unix,
java.io.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.
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic void close()
close in interface java.lang.AutoCloseable