Class SourceEmitterConfig.Builder

  • Enclosing class:
    SourceEmitterConfig

    public static final class SourceEmitterConfig.Builder
    extends Object
    Fluent builder for emitter settings; every setting has a default.
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • useVarKeyword

        public SourceEmitterConfig.Builder useVarKeyword​(boolean useVarKeyword)
        Sets whether local declarations use var instead of the declared type; defaults to false.
        Parameters:
        useVarKeyword - true to emit var
        Returns:
        this builder
      • includeIRComments

        public SourceEmitterConfig.Builder includeIRComments​(boolean includeIRComments)
        Sets whether IR detail is emitted as comments; defaults to false.
        Parameters:
        includeIRComments - true to emit IR comments
        Returns:
        this builder
      • includeLineNumbers

        public SourceEmitterConfig.Builder includeLineNumbers​(boolean includeLineNumbers)
        Sets whether original line numbers are emitted; defaults to false.
        Parameters:
        includeLineNumbers - true to emit line numbers
        Returns:
        this builder
      • indentString

        public SourceEmitterConfig.Builder indentString​(String indentString)
        Sets the string used for one indent level; defaults to a tab.
        Parameters:
        indentString - the indent string
        Returns:
        this builder
      • alwaysUseBraces

        public SourceEmitterConfig.Builder alwaysUseBraces​(boolean alwaysUseBraces)
        Sets whether single-statement bodies still get braces; defaults to true.
        Parameters:
        alwaysUseBraces - true to always brace bodies
        Returns:
        this builder
      • blankLinesBetweenMethods

        public SourceEmitterConfig.Builder blankLinesBetweenMethods​(boolean blankLinesBetweenMethods)
        Sets whether a blank line separates methods; defaults to true.
        Parameters:
        blankLinesBetweenMethods - true to separate methods with a blank line
        Returns:
        this builder
      • maxLineLength

        public SourceEmitterConfig.Builder maxLineLength​(int maxLineLength)
        Sets the line length the emitter wraps at; defaults to 120.
        Parameters:
        maxLineLength - the maximum line length
        Returns:
        this builder
      • useFullyQualifiedNames

        public SourceEmitterConfig.Builder useFullyQualifiedNames​(boolean useFullyQualifiedNames)
        Sets whether type names are emitted fully qualified instead of imported; defaults to false.
        Parameters:
        useFullyQualifiedNames - true to emit qualified names
        Returns:
        this builder
      • identifierMode

        public SourceEmitterConfig.Builder identifierMode​(IdentifierMode identifierMode)
        Sets how non-standard or obfuscated identifiers are emitted; defaults to RAW.
        Parameters:
        identifierMode - the identifier mode
        Returns:
        this builder
      • resolveBootstrapMethods

        public SourceEmitterConfig.Builder resolveBootstrapMethods​(boolean resolveBootstrapMethods)
        Sets whether invokedynamic sites are resolved back to the methods they call; defaults to false.
        Parameters:
        resolveBootstrapMethods - true to resolve bootstrap methods
        Returns:
        this builder
      • build

        public SourceEmitterConfig build()
        Returns:
        an immutable config holding the configured settings