public final class FunctionBuilder
extends java.lang.Object
JSTypeRegistry.createInterfaceType(java.lang.String, com.google.javascript.rhino.Node, com.google.common.collect.ImmutableList<com.google.javascript.rhino.jstype.TemplateType>, boolean)
.Modifier and Type | Field and Description |
---|---|
private boolean |
inferredReturnType |
private boolean |
isConstructor |
private boolean |
isNativeType |
private java.lang.String |
name |
private Node |
parametersNode |
private JSTypeRegistry |
registry |
private JSType |
returnType |
private Node |
sourceNode |
private TemplateTypeMap |
templateTypeMap |
private JSType |
typeOfThis |
Constructor and Description |
---|
FunctionBuilder(JSTypeRegistry registry) |
Modifier and Type | Method and Description |
---|---|
FunctionType |
build()
Construct a new function type.
|
FunctionBuilder |
copyFromOtherFunction(FunctionType otherType)
Copies all the information from another function type.
|
(package private) FunctionBuilder |
forNativeType()
Make this a native type.
|
FunctionBuilder |
setIsConstructor(boolean isConstructor)
Set whether this is a constructor.
|
FunctionBuilder |
withInferredReturnType(JSType returnType)
Sets an inferred return type.
|
FunctionBuilder |
withName(java.lang.String name)
Set the name of the function type.
|
FunctionBuilder |
withParamsNode(Node parametersNode)
Set the parameters of the function type with a specially-formatted node.
|
FunctionBuilder |
withReturnType(JSType returnType)
Set the return type.
|
FunctionBuilder |
withReturnType(JSType returnType,
boolean inferred)
Set the return type and whether it's inferred.
|
FunctionBuilder |
withSourceNode(Node sourceNode)
Set the source node of the function type.
|
FunctionBuilder |
withTemplateKeys(com.google.common.collect.ImmutableList<TemplateType> templateKeys)
Set the template name.
|
FunctionBuilder |
withTypeOfThis(JSType typeOfThis)
Set the "this" type.
|
private final JSTypeRegistry registry
private java.lang.String name
private Node sourceNode
private Node parametersNode
private JSType returnType
private JSType typeOfThis
private TemplateTypeMap templateTypeMap
private boolean inferredReturnType
private boolean isConstructor
private boolean isNativeType
public FunctionBuilder(JSTypeRegistry registry)
public FunctionBuilder withName(java.lang.String name)
public FunctionBuilder withSourceNode(Node sourceNode)
public FunctionBuilder withParamsNode(Node parametersNode)
public FunctionBuilder withReturnType(JSType returnType)
public FunctionBuilder withReturnType(JSType returnType, boolean inferred)
public FunctionBuilder withInferredReturnType(JSType returnType)
public FunctionBuilder withTypeOfThis(JSType typeOfThis)
public FunctionBuilder withTemplateKeys(com.google.common.collect.ImmutableList<TemplateType> templateKeys)
public FunctionBuilder setIsConstructor(boolean isConstructor)
FunctionBuilder forNativeType()
public FunctionBuilder copyFromOtherFunction(FunctionType otherType)
public FunctionType build()