Package org.jboss.jandex
Class TypeVariable
- java.lang.Object
-
- org.jboss.jandex.Type
-
- org.jboss.jandex.TypeVariable
-
public final class TypeVariable extends Type
Represents a resolved type parameter or type argument. Thename()
of this type variable corresponds to the raw type name. For type variables, the raw type name is the first upper bound. Theidentifier()
specifies the name of the type variable as specified in the source code.For example, consider the type variable:
T extends Number
Theidentifier()
is "T", while thename()
is "java.lang.Number".- Since:
- 2.0
- Author:
- Jason T. Greene
-
-
Field Summary
-
Fields inherited from class org.jboss.jandex.Type
EMPTY_ARRAY
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeVariable
asTypeVariable()
Casts this type to aParameterizedType
and returns it if the kind isType.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.-
Methods inherited from class org.jboss.jandex.Type
annotation, annotations, asArrayType, asClassType, asParameterizedType, asPrimitiveType, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, hasAnnotation, name, toString
-
-
-
-
Method Detail
-
identifier
public String identifier()
The identifier of this type variable as it appears in Java source code.The following class has a type parameter, with an identifier of "T":
class Foo<T extends Number> {}
- Returns:
- the identifier of this type variable
-
asTypeVariable
public TypeVariable asTypeVariable()
Description copied from class:Type
Casts this type to aParameterizedType
and returns it if the kind isType.Kind.TYPE_VARIABLE
Throws an exception otherwise.- Overrides:
asTypeVariable
in classType
- Returns:
- a
ClassType
-
equals
public boolean equals(Object o)
Description copied from class:Type
Compares this Type with another type, and returns true if they are equivalent. A type is equivalent to another type if it is the same kind, and all of its fields are equal. This includes annotations, which must be equal as well.- Overrides:
equals
in classType
- Parameters:
o
- the type to compare to- Returns:
- true if equal
- See Also:
Object.equals(Object)
-
-