public class PrettyPrinterConfiguration extends Object
PrettyPrinter
.Modifier and Type | Class and Description |
---|---|
static class |
PrettyPrinterConfiguration.IndentType |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY |
Constructor and Description |
---|
PrettyPrinterConfiguration() |
Modifier and Type | Method and Description |
---|---|
String |
getEndOfLineCharacter() |
String |
getIndent() |
int |
getIndentSize() |
PrettyPrinterConfiguration.IndentType |
getIndentType()
Get the type of indent to produce.
|
int |
getMaxEnumConstantsToAlignHorizontally() |
int |
getTabWidth()
Get the tab width for pretty aligning.
|
Function<PrettyPrinterConfiguration,VoidVisitor<Void>> |
getVisitorFactory() |
boolean |
isColumnAlignFirstMethodChain() |
boolean |
isColumnAlignParameters() |
boolean |
isIgnoreComments() |
boolean |
isIndentCaseInSwitch() |
boolean |
isOrderImports() |
boolean |
isPrintComments() |
boolean |
isPrintJavadoc() |
boolean |
isSpaceAroundOperators() |
PrettyPrinterConfiguration |
setColumnAlignFirstMethodChain(boolean columnAlignFirstMethodChain) |
PrettyPrinterConfiguration |
setColumnAlignParameters(boolean columnAlignParameters) |
PrettyPrinterConfiguration |
setEndOfLineCharacter(String endOfLineCharacter)
Set the character to append when a line should end.
|
PrettyPrinterConfiguration |
setIndentCaseInSwitch(boolean indentInSwitch) |
PrettyPrinterConfiguration |
setIndentSize(int indentSize)
Set the size of the indent in characters.
|
PrettyPrinterConfiguration |
setIndentType(PrettyPrinterConfiguration.IndentType indentType)
Set the type of indent to produce.
|
PrettyPrinterConfiguration |
setMaxEnumConstantsToAlignHorizontally(int maxEnumConstantsToAlignHorizontally)
By default enum constants get aligned like this:
|
PrettyPrinterConfiguration |
setOrderImports(boolean orderImports)
When true, orders imports by alphabetically.
|
PrettyPrinterConfiguration |
setPrintComments(boolean printComments)
When true, all comments will be printed, unless printJavadoc is false, then only line and block comments will be
printed.
|
PrettyPrinterConfiguration |
setPrintJavadoc(boolean printJavadoc)
When true, Javadoc will be printed.
|
PrettyPrinterConfiguration |
setSpaceAroundOperators(boolean spaceAroundOperators)
Set if there should be spaces between operators
|
PrettyPrinterConfiguration |
setTabWidth(int tabWidth)
Set the tab width for pretty aligning.
|
PrettyPrinterConfiguration |
setVisitorFactory(Function<PrettyPrinterConfiguration,VoidVisitor<Void>> visitorFactory)
Set the factory that creates the PrettyPrintVisitor.
|
public static final int DEFAULT_MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY
public String getIndent()
public int getIndentSize()
public PrettyPrinterConfiguration setIndentSize(int indentSize)
public PrettyPrinterConfiguration.IndentType getIndentType()
public PrettyPrinterConfiguration setIndentType(PrettyPrinterConfiguration.IndentType indentType)
public int getTabWidth()
public PrettyPrinterConfiguration setTabWidth(int tabWidth)
public boolean isOrderImports()
public boolean isPrintComments()
public boolean isIgnoreComments()
public boolean isSpaceAroundOperators()
public boolean isPrintJavadoc()
public boolean isColumnAlignParameters()
public boolean isColumnAlignFirstMethodChain()
public boolean isIndentCaseInSwitch()
public PrettyPrinterConfiguration setPrintComments(boolean printComments)
public PrettyPrinterConfiguration setPrintJavadoc(boolean printJavadoc)
public PrettyPrinterConfiguration setSpaceAroundOperators(boolean spaceAroundOperators)
public PrettyPrinterConfiguration setColumnAlignParameters(boolean columnAlignParameters)
public PrettyPrinterConfiguration setColumnAlignFirstMethodChain(boolean columnAlignFirstMethodChain)
public PrettyPrinterConfiguration setIndentCaseInSwitch(boolean indentInSwitch)
public Function<PrettyPrinterConfiguration,VoidVisitor<Void>> getVisitorFactory()
public PrettyPrinterConfiguration setVisitorFactory(Function<PrettyPrinterConfiguration,VoidVisitor<Void>> visitorFactory)
public String getEndOfLineCharacter()
public PrettyPrinterConfiguration setEndOfLineCharacter(String endOfLineCharacter)
public PrettyPrinterConfiguration setOrderImports(boolean orderImports)
public int getMaxEnumConstantsToAlignHorizontally()
public PrettyPrinterConfiguration setMaxEnumConstantsToAlignHorizontally(int maxEnumConstantsToAlignHorizontally)
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.
Copyright © 2007–2020. All rights reserved.