Class PrettyPrinterConfiguration


  • public class PrettyPrinterConfiguration
    extends Object
    Configuration options for the PrettyPrinter.
    • Field Detail

      • DEFAULT_MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY

        public static final int DEFAULT_MAX_ENUM_CONSTANTS_TO_ALIGN_HORIZONTALLY
        See Also:
        Constant Field Values
    • Constructor Detail

      • PrettyPrinterConfiguration

        public PrettyPrinterConfiguration()
    • Method Detail

      • getIndent

        public String getIndent()
        Returns:
        the string that will be used to indent.
      • getIndentSize

        public int getIndentSize()
      • getTabWidth

        public int getTabWidth()
        Get the tab width for pretty aligning.
      • isOrderImports

        public boolean isOrderImports()
      • isNormalizeEolInComment

        @Deprecated
        public boolean isNormalizeEolInComment()
        Deprecated.
        this is always on.
      • isPrintComments

        public boolean isPrintComments()
      • isIgnoreComments

        public boolean isIgnoreComments()
      • isPrintJavadoc

        public boolean isPrintJavadoc()
      • isColumnAlignParameters

        public boolean isColumnAlignParameters()
      • isColumnAlignFirstMethodChain

        public boolean isColumnAlignFirstMethodChain()
      • setPrintComments

        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

        public PrettyPrinterConfiguration setPrintJavadoc​(boolean printJavadoc)
        When true, Javadoc will be printed.
      • setColumnAlignFirstMethodChain

        public PrettyPrinterConfiguration setColumnAlignFirstMethodChain​(boolean columnAlignFirstMethodChain)
      • getEndOfLineCharacter

        public String getEndOfLineCharacter()
      • setEndOfLineCharacter

        public PrettyPrinterConfiguration setEndOfLineCharacter​(String endOfLineCharacter)
        Set the character to append when a line should end. Example values: "\n", "\r\n", "".
      • setOrderImports

        public PrettyPrinterConfiguration setOrderImports​(boolean orderImports)
        When true, orders imports by alphabetically.
      • getMaxEnumConstantsToAlignHorizontally

        public int getMaxEnumConstantsToAlignHorizontally()
      • setMaxEnumConstantsToAlignHorizontally

        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.