Package org.jboss.jandex
Class TypeVariable
java.lang.Object
org.jboss.jandex.Type
org.jboss.jandex.TypeVariable
Represents a resolved type parameter or type argument. The
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".- Since:
- 2.0
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Type[]
private int
private static final int
private static final int
private final String
Fields inherited from class org.jboss.jandex.Type
EMPTY_ARRAY
-
Constructor Summary
ConstructorsConstructorDescriptionTypeVariable
(String name) TypeVariable
(String name, Type[] bounds) TypeVariable
(String name, Type[] bounds, AnnotationInstance[] annotations) TypeVariable
(String name, Type[] bounds, AnnotationInstance[] annotations, boolean implicitObjectBound) -
Method Summary
Modifier and TypeMethodDescriptionCasts this type to aParameterizedType
and returns it if the kind isType.Kind.TYPE_VARIABLE
Throws an exception otherwise.(package private) Type[]
bounds()
(package private) TypeVariable
(package private) Type
copyType
(AnnotationInstance[] newAnnotations) boolean
Compares this Type with another type, and returns true if they are equivalent.int
hashCode()
Computes a hash code representing this type.(package private) boolean
The identifier of this type variable as it appears in Java source code.kind()
Returns the kind of Type this is.(package private) String
toString
(boolean simple) Methods inherited from class org.jboss.jandex.Type
addAnnotation, annotation, annotationArray, annotations, appendAnnotations, asArrayType, asClassType, asParameterizedType, asPrimitiveType, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, hasAnnotation, name, toString
-
Field Details
-
HASH_MASK
private static final int HASH_MASK- See Also:
-
IMPLICIT_MASK
private static final int IMPLICIT_MASK- See Also:
-
name
-
bounds
-
hash
private int hash
-
-
Constructor Details
-
TypeVariable
TypeVariable(String name) -
TypeVariable
-
TypeVariable
TypeVariable(String name, Type[] bounds, AnnotationInstance[] annotations) -
TypeVariable
TypeVariable(String name, Type[] bounds, AnnotationInstance[] annotations, boolean implicitObjectBound)
-
-
Method Details
-
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
-
bounds
-
boundArray
Type[] boundArray() -
hasImplicitObjectBound
boolean hasImplicitObjectBound() -
kind
Description copied from class:Type
Returns the kind of Type this is. -
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
-
toString
-
equals
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. -
copyType
-
copyType
-
hashCode
public int hashCode()Description copied from class:Type
Computes a hash code representing this type.
-