Class FunctionParamBuilder
- java.lang.Object
-
- com.google.javascript.rhino.jstype.FunctionParamBuilder
-
public class FunctionParamBuilder extends java.lang.Object
A builder for the list representing FunctionType Parameters
-
-
Constructor Summary
Constructors Constructor Description FunctionParamBuilder(JSTypeRegistry registry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addOptionalParams(JSType... types)
Add optional parameters of the given type to the end of the param list.boolean
addRequiredParams(JSType... types)
Add parameters of the given type to the end of the param list.boolean
addVarArgs(JSType type)
Add variable arguments to the end of the parameter list.com.google.common.collect.ImmutableList<FunctionType.Parameter>
build()
boolean
hasVarArgs()
void
newOptionalParameterFrom(FunctionType.Parameter p)
Copies the parameter specification from the given parameter, but makes sure it's optional.void
newParameterFrom(FunctionType.Parameter n)
Copies the parameter specification from the given parameter.
-
-
-
Constructor Detail
-
FunctionParamBuilder
public FunctionParamBuilder(JSTypeRegistry registry)
-
-
Method Detail
-
addRequiredParams
public boolean addRequiredParams(JSType... types)
Add parameters of the given type to the end of the param list.- Returns:
- False if this is called after optional params are added.
-
addOptionalParams
public boolean addOptionalParams(JSType... types)
Add optional parameters of the given type to the end of the param list.- Parameters:
types
- Types for each optional parameter. The builder will make them undefine-able.- Returns:
- False if this is called after var args are added.
-
addVarArgs
public boolean addVarArgs(JSType type)
Add variable arguments to the end of the parameter list.- Returns:
- False if this is called after var args are added.
-
newParameterFrom
public void newParameterFrom(FunctionType.Parameter n)
Copies the parameter specification from the given parameter.
-
newOptionalParameterFrom
public void newOptionalParameterFrom(FunctionType.Parameter p)
Copies the parameter specification from the given parameter, but makes sure it's optional.
-
hasVarArgs
public boolean hasVarArgs()
-
build
public com.google.common.collect.ImmutableList<FunctionType.Parameter> build()
-
-