Class CodePrinter.Builder

  • Enclosing class:
    CodePrinter

    public static final class CodePrinter.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

        public Builder​(Node node)
        Sets the root node from which to generate the source code.
        Parameters:
        node - The root node.
    • Method Detail

      • setPrettyPrint

        public CodePrinter.Builder setPrettyPrint​(boolean prettyPrint)
        Sets whether pretty printing should be used.
        Parameters:
        prettyPrint - If true, pretty printing will be used.
      • setLineBreak

        public CodePrinter.Builder setLineBreak​(boolean lineBreak)
        Sets whether line breaking should be done automatically.
        Parameters:
        lineBreak - If true, line breaking is done automatically.
      • setOutputTypes

        public CodePrinter.Builder setOutputTypes​(boolean outputTypes)
        Sets whether to output closure-style type annotations.
        Parameters:
        outputTypes - If true, outputs closure-style type annotations.
      • setSourceMap

        public CodePrinter.Builder setSourceMap​(SourceMap sourceMap)
        Sets the source map to which to write the metadata about the generated source code.
        Parameters:
        sourceMap - The source map.
      • setTagAsTypeSummary

        public CodePrinter.Builder setTagAsTypeSummary​(boolean tagAsTypeSummary)
        Set whether the output should be tagged as an .i.js file.
      • setTagAsStrict

        public CodePrinter.Builder setTagAsStrict​(boolean tagAsStrict)
        Set whether the output should be tags as ECMASCRIPT 5 Strict.
      • build

        public java.lang.String build()
        Generates the source code and returns it.