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, toStringpublic String identifier()
The following class has a type parameter, with an identifier of "T":
class Foo<T extends Number> {}
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(Object o)
Typeequals in class Typeo - the type to compare toObject.equals(Object)Copyright © 2022 JBoss by Red Hat. All rights reserved.