Class FunctionBuilder
- java.lang.Object
-
- com.google.javascript.rhino.jstype.FunctionBuilder
-
public final class FunctionBuilder extends java.lang.Object
A builder class for function and arrow types. If you need to build an interface constructor, useJSTypeRegistry.createInterfaceType(java.lang.String, com.google.javascript.rhino.Node)
.
-
-
Constructor Summary
Constructors Constructor Description FunctionBuilder(JSTypeRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FunctionType
build()
Construct a new function type.FunctionBuilder
copyFromOtherFunction(FunctionType otherType)
Copies all the information from another function type.FunctionBuilder
forConstructor()
Make this a constructor.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
withParams(FunctionParamBuilder params)
Set the parameters of the function type from a FunctionParamBuilder.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.
-
-
-
Constructor Detail
-
FunctionBuilder
public FunctionBuilder(JSTypeRegistry registry)
-
-
Method Detail
-
withName
public FunctionBuilder withName(java.lang.String name)
Set the name of the function type.
-
withSourceNode
public FunctionBuilder withSourceNode(Node sourceNode)
Set the source node of the function type.
-
withParams
public FunctionBuilder withParams(FunctionParamBuilder params)
Set the parameters of the function type from a FunctionParamBuilder.
-
withParamsNode
public FunctionBuilder withParamsNode(Node parametersNode)
Set the parameters of the function type with a specially-formatted node.
-
withReturnType
public FunctionBuilder withReturnType(JSType returnType)
Set the return type.
-
withReturnType
public FunctionBuilder withReturnType(JSType returnType, boolean inferred)
Set the return type and whether it's inferred.
-
withInferredReturnType
public FunctionBuilder withInferredReturnType(JSType returnType)
Sets an inferred return type.
-
withTypeOfThis
public FunctionBuilder withTypeOfThis(JSType typeOfThis)
Set the "this" type.
-
withTemplateKeys
public FunctionBuilder withTemplateKeys(com.google.common.collect.ImmutableList<TemplateType> templateKeys)
Set the template name.
-
forConstructor
public FunctionBuilder forConstructor()
Make this a constructor.
-
setIsConstructor
public FunctionBuilder setIsConstructor(boolean isConstructor)
Set whether this is a constructor.
-
copyFromOtherFunction
public FunctionBuilder copyFromOtherFunction(FunctionType otherType)
Copies all the information from another function type.
-
build
public FunctionType build()
Construct a new function type.
-
-