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".EMPTY_ARRAY
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. |
List<Type> |
bounds() |
boolean |
equals(Object o)
Compares this Type with another type, and returns true if they are equivalent.
|
int |
hashCode()
Computes a hash code representing this type.
|
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.
|
annotations, asArrayType, asClassType, asParameterizedType, asPrimitiveType, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, name, toString
public String identifier()
The following class has a type parameter, with an identifier of "T":
class Foo<T extends Number> {}
public TypeVariable asTypeVariable()
Type
ParameterizedType
and returns it if the kind is
Type.Kind.TYPE_VARIABLE
Throws an exception otherwise.asTypeVariable
in class Type
ClassType
public boolean equals(Object o)
Type
equals
in class Type
o
- the type to compare toObject.equals(Object)
Copyright © 2018 JBoss by Red Hat. All rights reserved.