public interface Types
| Modifier and Type | Method and Description |
|---|---|
Type |
of(java.lang.Class<?> clazz)
Returns a type from given class literal.
|
ArrayType |
ofArray(Type elementType,
int dimensions)
Returns an
ArrayType for the given element type and number of dimensions. |
ClassType |
ofClass(ClassInfo clazz)
Returns a
ClassType for the given class declaration. |
ClassType |
ofClass(java.lang.String name)
Returns a
ClassType for the given binary name, as defined by The Java™ Language Specification;
in other words, the class name as returned by Class.getName(). |
PrimitiveType |
ofPrimitive(PrimitiveType.PrimitiveKind kind)
Returns a
PrimitiveType for the given kind of primitive type. |
VoidType |
ofVoid()
Returns a
VoidType, representing the void pseudo-type. |
ParameterizedType |
parameterized(java.lang.Class<?> genericType,
java.lang.Class<?>... typeArguments)
Returns a
ParameterizedType for the given generic type and type arguments. |
ParameterizedType |
parameterized(java.lang.Class<?> genericType,
Type... typeArguments)
Returns a
ParameterizedType for the given generic type and type arguments. |
ParameterizedType |
parameterized(ClassType genericType,
Type... typeArguments)
Returns a
ParameterizedType for the given generic type and type arguments. |
WildcardType |
wildcardUnbounded()
Returns a
WildcardType that represents an equivalent of ?. |
WildcardType |
wildcardWithLowerBound(Type lowerBound)
Returns a
WildcardType that represents an equivalent of ? super lowerBound. |
WildcardType |
wildcardWithUpperBound(Type upperBound)
Returns a
WildcardType that represents an equivalent of ? extends upperBound. |
Type of(java.lang.Class<?> clazz)
of(void.class): same as ofVoid()of(int.class): same as ofPrimitive(PrimitiveKind.INT)of(String.class): same as ofClass(... ClassInfo for String ...)of(int[].class): same as ofArray(ofPrimitive(PrimitiveKind.INT), 1)of(String[][].class): same as ofArray(ofClass(... ClassInfo for String ...), 2)clazz - the class literal, must not be nullType object representing the given class literalVoidType ofVoid()
VoidType, representing the void pseudo-type.VoidType, never nullPrimitiveType ofPrimitive(PrimitiveType.PrimitiveKind kind)
PrimitiveType for the given kind of primitive type.kind - the primitive type kind, must not be nullPrimitiveType, never nullClassType ofClass(java.lang.String name)
ClassType for the given binary name, as defined by The Java™ Language Specification;
in other words, the class name as returned by Class.getName().
Note that this method returns ClassType, so name may only be a name of a class.
For primitives, use ofPrimitive(PrimitiveType.PrimitiveKind). For arrays, use ofArray(Type, int).
name - the binary name of the class, must not be nullClassType or null if the class is not present in any bean archiveClassType ofClass(ClassInfo clazz)
ClassType for the given class declaration.ArrayType ofArray(Type elementType, int dimensions)
ArrayType for the given element type and number of dimensions.
Note that this method accepts the element type of an array, even though ArrayType
uses a component type representation. For example, the component type of String[][]
is String[], while the element type is String.
ParameterizedType parameterized(java.lang.Class<?> genericType, java.lang.Class<?>... typeArguments)
ParameterizedType for the given generic type and type arguments.
The array of type arguments must have the same shape as the generic type's
list of type parameters.genericType - the type to parameterize, must not be nulltypeArguments - one or more type argumentsnulljava.lang.IllegalArgumentException - if given genericType is not generic or if the number of type arguments
does not match the number of type parameters declared by genericTypeParameterizedType parameterized(java.lang.Class<?> genericType, Type... typeArguments)
ParameterizedType for the given generic type and type arguments.
The array of type arguments must have the same shape as the generic type's
list of type parameters.genericType - the type to parameterize, must not be nulltypeArguments - one or more type argumentsnulljava.lang.IllegalArgumentException - if given genericType is not generic or if the number of type arguments
does not match the number of type parameters declared by genericTypeParameterizedType parameterized(ClassType genericType, Type... typeArguments)
ParameterizedType for the given generic type and type arguments.
The array of type arguments must have the same shape as the generic type's
list of type parameters.genericType - the type to parameterize, must not be nulltypeArguments - one or more type argumentsnulljava.lang.IllegalArgumentException - if given genericType is not generic or if the number of type arguments
does not match the number of type parameters declared by genericTypeWildcardType wildcardWithUpperBound(Type upperBound)
WildcardType that represents an equivalent of ? extends upperBound.
Note that if upperBound represents the java.lang.Object type, then the result
is equivalent to wildcardUnbounded().upperBound - upper bound type, must not be nullWildcardType object representing a wildcard type with given upper boundWildcardType wildcardWithLowerBound(Type lowerBound)
WildcardType that represents an equivalent of ? super lowerBound.lowerBound - lower bound type, must not be nullWildcardType object representing a wildcard type with given upper boundWildcardType wildcardUnbounded()
WildcardType that represents an equivalent of ?.WildcardType object representing an unbounded wildcard type