public static final class CodePrinter.Builder
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
CodePrinter.Builder.CodeGeneratorFactory |
Modifier and Type | Field and Description |
---|---|
private CodePrinter.Builder.CodeGeneratorFactory |
codeGeneratorFactory |
private boolean |
lineBreak |
private CompilerOptions |
options |
private boolean |
outputTypes |
private boolean |
prettyPrint |
private TypeIRegistry |
registry |
private Node |
root |
private SourceMap |
sourceMap |
private boolean |
tagAsStrict |
Constructor and Description |
---|
Builder(Node node)
Sets the root node from which to generate the source code.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
build()
Generates the source code and returns it.
|
CodePrinter.Builder |
setCompilerOptions(CompilerOptions options)
Sets the output options from compiler options.
|
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 |
setSourceMap(SourceMap sourceMap)
Sets the source map to which to write the metadata about
the generated source code.
|
CodePrinter.Builder |
setTagAsStrict(boolean tagAsStrict)
Set whether the output should be tags as ECMASCRIPT 5 Strict.
|
CodePrinter.Builder |
setTypeRegistry(TypeIRegistry registry) |
private final Node root
private CompilerOptions options
private boolean lineBreak
private boolean prettyPrint
private boolean outputTypes
private SourceMap sourceMap
private boolean tagAsStrict
private TypeIRegistry registry
private CodePrinter.Builder.CodeGeneratorFactory codeGeneratorFactory
public Builder(Node node)
node
- The root node.public CodePrinter.Builder setCompilerOptions(CompilerOptions options)
public CodePrinter.Builder setTypeRegistry(TypeIRegistry registry)
public CodePrinter.Builder setPrettyPrint(boolean prettyPrint)
prettyPrint
- If true, pretty printing will be used.public CodePrinter.Builder setLineBreak(boolean lineBreak)
lineBreak
- If true, line breaking is done automatically.public CodePrinter.Builder setOutputTypes(boolean outputTypes)
outputTypes
- If true, outputs closure-style type annotations.public CodePrinter.Builder setSourceMap(SourceMap sourceMap)
sourceMap
- The source map.public CodePrinter.Builder setTagAsStrict(boolean tagAsStrict)
public java.lang.String build()