PrettyPrinter.
| Modifier and Type | Class and Description |
|---|---|
| public static enum |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private boolean | |
| public static final int | |
| private String | |
| private int | |
| private PrettyPrinterConfiguration. | |
| private int | |
| private boolean | |
| private boolean | |
| private boolean | |
| private int | |
| private Function |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public String | |
| public int | |
| public PrettyPrinterConfiguration. | |
| public int | |
| public int | |
| public Function | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public PrettyPrinterConfiguration | |
| public PrettyPrinterConfiguration | |
| public PrettyPrinterConfiguration | |
| public PrettyPrinterConfiguration | |
| public PrettyPrinterConfiguration | |
| public PrettyPrinterConfiguration | setMaxEnumConstantsToAlignHorizontally(int maxEnumConstantsToAlignHorizontally)
By default enum constants get aligned like this:
enum X {
A, B, C, D
}
|
| public PrettyPrinterConfiguration | |
| public PrettyPrinterConfiguration | setPrintComments(boolean printComments)
When true, all comments will be printed, unless printJavadoc is false, then only line and block comments will be printed. |
| public PrettyPrinterConfiguration | |
| public PrettyPrinterConfiguration | |
| public PrettyPrinterConfiguration | setVisitorFactory(Function<PrettyPrinterConfiguration, VoidVisitor<Void>> visitorFactory)
Set the factory that creates the PrettyPrintVisitor. |
| columnAlignFirstMethodChain | back to summary |
|---|---|
| private boolean columnAlignFirstMethodChain | |
| columnAlignParameters | back to summary |
|---|---|
| private boolean columnAlignParameters | |
| DEFAULT_MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY | back to summary |
|---|---|
| public static final int DEFAULT_MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY | |
| endOfLineCharacter | back to summary |
|---|---|
| private String endOfLineCharacter | |
| indentSize | back to summary |
|---|---|
| private int indentSize | |
| indentType | back to summary |
|---|---|
| private PrettyPrinterConfiguration. | |
| maxEnumConstantsToAlignHorizontally | back to summary |
|---|---|
| private int maxEnumConstantsToAlignHorizontally | |
| orderImports | back to summary |
|---|---|
| private boolean orderImports | |
| printComments | back to summary |
|---|---|
| private boolean printComments | |
| printJavadoc | back to summary |
|---|---|
| private boolean printJavadoc | |
| tabWidth | back to summary |
|---|---|
| private int tabWidth | |
| visitorFactory | back to summary |
|---|---|
| private Function<PrettyPrinterConfiguration, VoidVisitor<Void>> visitorFactory | |
| PrettyPrinterConfiguration | back to summary |
|---|---|
| public PrettyPrinterConfiguration() | |
| getEndOfLineCharacter | back to summary |
|---|---|
| public String getEndOfLineCharacter() | |
| getIndent | back to summary |
|---|---|
public String getIndent()
| |
| getIndentSize | back to summary |
|---|---|
| public int getIndentSize() | |
| getIndentType | back to summary |
|---|---|
| public PrettyPrinterConfiguration. Get the type of indent to produce. | |
| getMaxEnumConstantsToAlignHorizontally | back to summary |
|---|---|
| public int getMaxEnumConstantsToAlignHorizontally() | |
| getTabWidth | back to summary |
|---|---|
| public int getTabWidth() Get the tab width for pretty aligning. | |
| getVisitorFactory | back to summary |
|---|---|
| public Function | |
| isColumnAlignFirstMethodChain | back to summary |
|---|---|
| public boolean isColumnAlignFirstMethodChain() | |
| isColumnAlignParameters | back to summary |
|---|---|
| public boolean isColumnAlignParameters() | |
| isIgnoreComments | back to summary |
|---|---|
| public boolean isIgnoreComments() | |
| isOrderImports | back to summary |
|---|---|
| public boolean isOrderImports() | |
| isPrintComments | back to summary |
|---|---|
| public boolean isPrintComments() | |
| isPrintJavadoc | back to summary |
|---|---|
| public boolean isPrintJavadoc() | |
| setColumnAlignFirstMethodChain | back to summary |
|---|---|
| public PrettyPrinterConfiguration setColumnAlignFirstMethodChain(boolean columnAlignFirstMethodChain) | |
| setColumnAlignParameters | back to summary |
|---|---|
| public PrettyPrinterConfiguration setColumnAlignParameters(boolean columnAlignParameters) | |
| setEndOfLineCharacter | back to summary |
|---|---|
| public PrettyPrinterConfiguration setEndOfLineCharacter(String endOfLineCharacter) Set the character to append when a line should end. Example values: "\n", "\r\n", "". | |
| setIndentSize | back to summary |
|---|---|
| public PrettyPrinterConfiguration setIndentSize(int indentSize) Set the size of the indent in characters. | |
| setIndentType | back to summary |
|---|---|
| public PrettyPrinterConfiguration setIndentType(PrettyPrinterConfiguration. Set the type of indent to produce. | |
| setMaxEnumConstantsToAlignHorizontally | back to summary |
|---|---|
| public PrettyPrinterConfiguration setMaxEnumConstantsToAlignHorizontally(int maxEnumConstantsToAlignHorizontally) By default enum constants get aligned like this:
enum X {
A, B, C, D
}
until the amount of constants passes this value (5 by default).
Then they get aligned like this:
enum X {
A,
B,
C,
D,
E,
F,
G
}
Set it to a large number to always align horizontally.
Set it to 1 or less to always align vertically.
| |
| setOrderImports | back to summary |
|---|---|
| public PrettyPrinterConfiguration setOrderImports(boolean orderImports) When true, orders imports by alphabetically. | |
| setPrintComments | back to summary |
|---|---|
| public PrettyPrinterConfiguration setPrintComments(boolean printComments) When true, all comments will be printed, unless printJavadoc is false, then only line and block comments will be printed. | |
| setPrintJavadoc | back to summary |
|---|---|
| public PrettyPrinterConfiguration setPrintJavadoc(boolean printJavadoc) When true, Javadoc will be printed. | |
| setTabWidth | back to summary |
|---|---|
| public PrettyPrinterConfiguration setTabWidth(int tabWidth) Set the tab width for pretty aligning. | |
| setVisitorFactory | back to summary |
|---|---|
| public PrettyPrinterConfiguration setVisitorFactory(Function<PrettyPrinterConfiguration, VoidVisitor<Void>> visitorFactory) Set the factory that creates the PrettyPrintVisitor. By changing this you can make the PrettyPrinter use a custom PrettyPrinterVisitor. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final PrettyPrinterConfiguration. | SPACES
Indent with spaces. |
| public static final PrettyPrinterConfiguration. | TABS
Indent with tabs as far as possible. |
| public static final PrettyPrinterConfiguration. | TABS_WITH_SPACE_ALIGN
Indent with tabs but align with spaces when wrapping and aligning method call chains and method call parameters. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static PrettyPrinterConfiguration. | |
| public static PrettyPrinterConfiguration. |
| SPACES | back to summary |
|---|---|
| public static final PrettyPrinterConfiguration. Indent with spaces. | |
| TABS | back to summary |
|---|---|
| public static final PrettyPrinterConfiguration. Indent with tabs as far as possible. For proper aligning, the tab width is necessary and by default 4. | |
| TABS_WITH_SPACE_ALIGN | back to summary |
|---|---|
| public static final PrettyPrinterConfiguration. Indent with tabs but align with spaces when wrapping and aligning method call chains and method call parameters. Example result:
class Foo {
\tvoid bar() {
\t\tfoo().bar()
\t\t......baz(() -> {
\t\t..........\tboo().baa()
\t\t..........\t......bee(a,
\t\t..........\t..........b,
\t\t..........\t..........c);
\t\t..........})
\t\t......bam();
\t}
}
| |
| IndentType | back to summary |
|---|---|
| private IndentType() | |
| valueOf | back to summary |
|---|---|
| public static PrettyPrinterConfiguration. | |
| values | back to summary |
|---|---|
| public static PrettyPrinterConfiguration. | |