public class TypeBuilder extends Object
| Constructor and Description |
|---|
TypeBuilder(ModelFactory factory,
Type context)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
TypeBuilder |
array(int dimensions)
Returns the array type.
|
ExpressionBuilder |
constructorReference()
Returns the constructor invocation using the building type as its qualifier.
|
ExpressionBuilder |
constructorReference(List<? extends Type> typeArguments)
Returns the constructor invocation using the building type as its qualifier.
|
TypeBuilder |
copy()
Returns a copy of this builder.
|
ExpressionBuilder |
dotClass()
Returns a class literal.
|
ExpressionBuilder |
dotThis()
Returns a qualified this.
|
TypeBuilder |
enclose(Name name)
Returns the qualified type.
|
TypeBuilder |
enclose(String name)
Returns the qualified type.
|
ExpressionBuilder |
field(SimpleName name)
Returns the field access expression.
|
ExpressionBuilder |
field(String name)
Returns the field access expression.
|
ExpressionBuilder |
method(List<? extends Type> typeArguments,
SimpleName name,
Expression... arguments)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
method(List<? extends Type> typeArguments,
SimpleName name,
List<? extends Expression> arguments)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
method(List<? extends Type> typeArguments,
String name,
Expression... arguments)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
method(List<? extends Type> typeArguments,
String name,
List<? extends Expression> arguments)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
method(SimpleName name,
Expression... arguments)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
method(SimpleName name,
List<? extends Expression> arguments)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
method(String name,
Expression... arguments)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
method(String name,
List<? extends Expression> arguments)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
methodReference(List<? extends Type> typeArguments,
SimpleName name)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
methodReference(List<? extends Type> typeArguments,
String name)
Returns the method invocation using the building type as its qualifier.
|
ExpressionBuilder |
methodReference(SimpleName name)
Returns the method reference using the building type as its qualifier.
|
ExpressionBuilder |
methodReference(String name)
Returns the method reference using the building type as its qualifier.
|
ExpressionBuilder |
newArray(ArrayInitializer initializer)
Returns the array instance creation expression.
|
ExpressionBuilder |
newArray(Expression... dimensions)
Returns the array instance creation expression.
|
ExpressionBuilder |
newArray(int... dimensions)
Returns the array instance creation expression.
|
ExpressionBuilder |
newArray(List<? extends Expression> dimensions)
Returns the array instance creation expression.
|
ExpressionBuilder |
newObject(Expression... arguments)
Returns the class instance creation expression.
|
ExpressionBuilder |
newObject(List<? extends Expression> arguments)
Returns the class instance creation expression.
|
ExpressionBuilder |
newObject(List<? extends Expression> arguments,
ClassBody anonymousClassBlock)
Returns the class instance creation expression.
|
TypeBuilder |
parameterize()
Returns the parameterized type (as diamond operator).
|
TypeBuilder |
parameterize(List<? extends Type> typeArguments)
Returns the parameterized type.
|
TypeBuilder |
parameterize(Type... typeArguments)
Returns the parameterized type.
|
TypeBuilder |
parameterize(Type... typeArguments)
Returns the parameterized type.
|
ArrayType |
toArrayType()
Returns the built type as an array type.
|
NamedType |
toNamedType()
Returns the built type as a named type.
|
Type |
toType()
Returns the built type.
|
public TypeBuilder(ModelFactory factory, Type context)
factory - the Java DOM factorycontext - the context typeIllegalArgumentException - if the parameters are nullpublic TypeBuilder copy()
public Type toType()
public NamedType toNamedType()
IllegalStateException - the building type is not a named typepublic ArrayType toArrayType()
IllegalStateException - the building type is not an array typepublic TypeBuilder parameterize()
IllegalArgumentException - if the parameter is nullpublic TypeBuilder parameterize(Type... typeArguments)
typeArguments - the type argumentsIllegalArgumentException - if the parameter is nullpublic TypeBuilder parameterize(List<? extends Type> typeArguments)
typeArguments - the type argumentsIllegalArgumentException - if the parameter is nullpublic TypeBuilder parameterize(Type... typeArguments)
typeArguments - the type argumentsIllegalArgumentException - if the parameter is nullpublic TypeBuilder enclose(Name name)
name - the enclosing type nameIllegalArgumentException - if the parameter is nullpublic TypeBuilder enclose(String name)
name - the enclosing type nameIllegalArgumentException - if the parameter is nullpublic TypeBuilder array(int dimensions)
dimensions - the number of dimensionsIllegalArgumentException - if the parameter is a negative valuepublic ExpressionBuilder dotClass()
public ExpressionBuilder dotThis()
public ExpressionBuilder newArray(int... dimensions)
dimensions - the number of array elements for each dimensionIllegalStateException - if the building type is not an array typeIllegalArgumentException - if the parameter is nullpublic ExpressionBuilder newArray(Expression... dimensions)
dimensions - the number of array elements for each dimensionIllegalStateException - if the building type is not an array typeIllegalArgumentException - if the parameter is nullpublic ExpressionBuilder newArray(List<? extends Expression> dimensions)
dimensions - the number of array elements for each dimensionIllegalStateException - if the building type is not an array typeIllegalArgumentException - if the parameter is nullpublic ExpressionBuilder newArray(ArrayInitializer initializer)
initializer - the array initializerIllegalStateException - if the building type is not an array typeIllegalArgumentException - if the parameter is nullpublic ExpressionBuilder newObject(Expression... arguments)
arguments - the constructor argumentsIllegalArgumentException - if the parameter is nullpublic ExpressionBuilder newObject(List<? extends Expression> arguments)
arguments - the constructor argumentsIllegalArgumentException - if the parameter is nullpublic ExpressionBuilder newObject(List<? extends Expression> arguments, ClassBody anonymousClassBlock)
arguments - the constructor argumentsanonymousClassBlock - the anonymous class block (nullable)IllegalArgumentException - if the parameter is nullpublic ExpressionBuilder field(String name)
name - the target field nameIllegalArgumentException - if the parameter is nullpublic ExpressionBuilder field(SimpleName name)
name - the target field nameIllegalArgumentException - if the parameter is nullpublic ExpressionBuilder method(String name, Expression... arguments)
name - the target method namearguments - the method argumentsIllegalStateException - the building type is not a named typeIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder method(List<? extends Type> typeArguments, String name, Expression... arguments)
typeArguments - the type argumentsname - the target method namearguments - the method argumentsIllegalStateException - the building type is not a named typeIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder method(String name, List<? extends Expression> arguments)
name - the target method namearguments - the method argumentsIllegalStateException - the building type is not a named typeIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder method(List<? extends Type> typeArguments, String name, List<? extends Expression> arguments)
typeArguments - the type argumentsname - the target method namearguments - the method argumentsIllegalStateException - the building type is not a named typeIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder method(SimpleName name, Expression... arguments)
name - the target method namearguments - the method argumentsIllegalStateException - the building type is not a named typeIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder method(List<? extends Type> typeArguments, SimpleName name, Expression... arguments)
typeArguments - the type argumentsname - the target method namearguments - the method argumentsIllegalStateException - the building type is not a named typeIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder method(SimpleName name, List<? extends Expression> arguments)
name - the target method namearguments - the method argumentsIllegalStateException - the building type is not a named typeIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder method(List<? extends Type> typeArguments, SimpleName name, List<? extends Expression> arguments)
typeArguments - the type argumentsname - the target method namearguments - the method argumentsIllegalStateException - the building type is not a named typeIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder constructorReference()
public ExpressionBuilder constructorReference(List<? extends Type> typeArguments)
typeArguments - the type argumentsIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder methodReference(String name)
name - the target method nameIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder methodReference(SimpleName name)
name - the target method nameIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder methodReference(List<? extends Type> typeArguments, String name)
typeArguments - the type argumentsname - the target method nameIllegalArgumentException - if the parameters are nullpublic ExpressionBuilder methodReference(List<? extends Type> typeArguments, SimpleName name)
typeArguments - the type argumentsname - the target method nameIllegalArgumentException - if the parameters are nullCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.