Package com.google.javascript.jscomp
Class CodePrinter.Builder
- java.lang.Object
-
- com.google.javascript.jscomp.CodePrinter.Builder
-
- Enclosing class:
- CodePrinter
public static final class CodePrinter.Builder extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CodePrinter.Builder.CodeGeneratorFactory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
build()
Generates the source code and returns it.CodePrinter.SourceAndMappings
buildWithSourceMappings()
CodePrinter.Builder
setCodeGeneratorFactory(CodePrinter.Builder.CodeGeneratorFactory factory)
Set a custom code generator factory to enable custom code generation.CodePrinter.Builder
setCompilerOptions(CompilerOptions options)
Sets the output options from compiler options.CodePrinter.Builder
setLicenseTracker(CodePrinter.LicenseTracker licenseTracker)
Sets the license tracker to use when printing.CodePrinter.Builder
setLineBreak(boolean lineBreak)
Sets whether line breaking should be done automatically.CodePrinter.Builder
setOutputTypes(boolean outputTypes)
Sets whether to output closure-style type annotations.CodePrinter.Builder
setPrettyPrint(boolean prettyPrint)
Sets whether pretty printing should be used.CodePrinter.Builder
setTagAsStrict(boolean tagAsStrict)
Set whether the output should be tags as ECMASCRIPT 5 Strict.CodePrinter.Builder
setTagAsTypeSummary(boolean tagAsTypeSummary)
Set whether the output should be tagged as an .i.js file.CodePrinter.Builder
setTypeRegistry(JSTypeRegistry registry)
-
-
-
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
-
setCompilerOptions
@CanIgnoreReturnValue public CodePrinter.Builder setCompilerOptions(CompilerOptions options)
Sets the output options from compiler options.
-
setTypeRegistry
@CanIgnoreReturnValue public CodePrinter.Builder setTypeRegistry(JSTypeRegistry registry)
-
setPrettyPrint
@CanIgnoreReturnValue public CodePrinter.Builder setPrettyPrint(boolean prettyPrint)
Sets whether pretty printing should be used.- Parameters:
prettyPrint
- If true, pretty printing will be used.
-
setLineBreak
@CanIgnoreReturnValue public CodePrinter.Builder setLineBreak(boolean lineBreak)
Sets whether line breaking should be done automatically.- Parameters:
lineBreak
- If true, line breaking is done automatically.
-
setOutputTypes
@CanIgnoreReturnValue public CodePrinter.Builder setOutputTypes(boolean outputTypes)
Sets whether to output closure-style type annotations.- Parameters:
outputTypes
- If true, outputs closure-style type annotations.
-
setLicenseTracker
@CanIgnoreReturnValue public CodePrinter.Builder setLicenseTracker(CodePrinter.LicenseTracker licenseTracker)
Sets the license tracker to use when printing.- Parameters:
licenseTracker
- The tracker to use. Can be null to disable license tracking.
-
setTagAsTypeSummary
@CanIgnoreReturnValue public CodePrinter.Builder setTagAsTypeSummary(boolean tagAsTypeSummary)
Set whether the output should be tagged as an .i.js file.
-
setTagAsStrict
@CanIgnoreReturnValue public CodePrinter.Builder setTagAsStrict(boolean tagAsStrict)
Set whether the output should be tags as ECMASCRIPT 5 Strict.
-
setCodeGeneratorFactory
@CanIgnoreReturnValue public CodePrinter.Builder setCodeGeneratorFactory(CodePrinter.Builder.CodeGeneratorFactory factory)
Set a custom code generator factory to enable custom code generation.
-
build
public java.lang.String build()
Generates the source code and returns it.
-
buildWithSourceMappings
public CodePrinter.SourceAndMappings buildWithSourceMappings()
-
-