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,PrettyPrintVisitor> |
getVisitorFactory() |
boolean |
isColumnAlignFirstMethodChain() |
boolean |
isColumnAlignParameters() |
boolean |
isIgnoreComments() |
boolean |
isNormalizeEolInComment()
Deprecated.
this is always on.
|
boolean |
isOrderImports() |
boolean |
isPrintComments() |
boolean |
isPrintJavadoc() |
PrettyPrinterConfiguration |
setColumnAlignFirstMethodChain(boolean columnAlignFirstMethodChain) |
PrettyPrinterConfiguration |
setColumnAlignParameters(boolean columnAlignParameters) |
PrettyPrinterConfiguration |
setEndOfLineCharacter(String endOfLineCharacter)
Set the character to append when a line should end.
|
PrettyPrinterConfiguration |
setIndent(String indent)
Deprecated.
|
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 |
setNormalizeEolInComment(boolean normalizeEolInComment)
Deprecated.
this is always on.
|
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 |
setTabWidth(int tabWidth)
Set the tab width for pretty aligning.
|
PrettyPrinterConfiguration |
setVisitorFactory(Function<PrettyPrinterConfiguration,PrettyPrintVisitor> visitorFactory)
Set the factory that creates the PrettyPrintVisitor.
|
public static final int DEFAULT_MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY
@Deprecated public PrettyPrinterConfiguration setIndent(String indent)
setIndentSize(int)
and setIndentType(IndentType)
.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()
@Deprecated public boolean isNormalizeEolInComment()
@Deprecated public PrettyPrinterConfiguration setNormalizeEolInComment(boolean normalizeEolInComment)
public boolean isPrintComments()
public boolean isIgnoreComments()
public boolean isPrintJavadoc()
public boolean isColumnAlignParameters()
public boolean isColumnAlignFirstMethodChain()
public PrettyPrinterConfiguration setPrintComments(boolean printComments)
public PrettyPrinterConfiguration setPrintJavadoc(boolean printJavadoc)
public PrettyPrinterConfiguration setColumnAlignParameters(boolean columnAlignParameters)
public PrettyPrinterConfiguration setColumnAlignFirstMethodChain(boolean columnAlignFirstMethodChain)
public Function<PrettyPrinterConfiguration,PrettyPrintVisitor> getVisitorFactory()
public PrettyPrinterConfiguration setVisitorFactory(Function<PrettyPrinterConfiguration,PrettyPrintVisitor> 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–2018. All rights reserved.