public final class TypeVariable extends Type
name() of this type variable
corresponds to the raw type name. For type variables, the raw type name is the first upper bound. The
identifier() specifies the name of the type variable as specified in the source code.
For example, consider the type variable:
T extends NumberThe
identifier() is "T", while the name() is "java.lang.Number".| Modifier and Type | Field and Description |
|---|---|
private Type[] |
bounds |
private int |
hash |
private java.lang.String |
name |
EMPTY_ARRAY| Constructor and Description |
|---|
TypeVariable(java.lang.String name) |
TypeVariable(java.lang.String name,
Type[] bounds) |
TypeVariable(java.lang.String name,
Type[] bounds,
AnnotationInstance[] annotations) |
| Modifier and Type | Method and Description |
|---|---|
TypeVariable |
asTypeVariable()
Casts this type to a
ParameterizedType and returns it if the kind is
Type.Kind.TYPE_VARIABLE
Throws an exception otherwise. |
(package private) Type[] |
boundArray() |
java.util.List<Type> |
bounds() |
(package private) Type |
copyType(AnnotationInstance[] newAnnotations) |
(package private) TypeVariable |
copyType(int boundIndex,
Type bound) |
boolean |
equals(java.lang.Object o)
Compares this Type with another type, and returns true if they are equivalent.
|
int |
hashCode()
Computes a hash code representing this type.
|
java.lang.String |
identifier()
The identifier of this type variable as it appears in Java source code.
|
Type.Kind |
kind()
Returns the kind of Type this is.
|
(package private) java.lang.String |
toString(boolean simple) |
addAnnotation, annotationArray, annotations, appendAnnotations, asArrayType, asClassType, asParameterizedType, asPrimitiveType, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, name, toStringprivate final java.lang.String name
private final Type[] bounds
private int hash
TypeVariable(java.lang.String name)
TypeVariable(java.lang.String name,
Type[] bounds)
TypeVariable(java.lang.String name,
Type[] bounds,
AnnotationInstance[] annotations)
public java.lang.String identifier()
The following class has a type parameter, with an identifier of "T":
class Foo<T extends Number> {}
public java.util.List<Type> bounds()
Type[] boundArray()
public TypeVariable asTypeVariable()
TypeParameterizedType and returns it if the kind is
Type.Kind.TYPE_VARIABLE
Throws an exception otherwise.asTypeVariable in class TypeClassTypepublic boolean equals(java.lang.Object o)
TypeType copyType(AnnotationInstance[] newAnnotations)
TypeVariable copyType(int boundIndex, Type bound)