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
-
-
Field Summary
Fields Modifier and Type Field Description private Type[]boundsprivate inthashprivate static intHASH_MASKprivate static intIMPLICIT_MASKprivate java.lang.Stringname-
Fields inherited from class org.jboss.jandex.Type
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description TypeVariable(java.lang.String name)TypeVariable(java.lang.String name, Type[] bounds)TypeVariable(java.lang.String name, Type[] bounds, AnnotationInstance[] annotations)TypeVariable(java.lang.String name, Type[] bounds, AnnotationInstance[] annotations, boolean implicitObjectBound)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeVariableasTypeVariable()Casts this type to aParameterizedTypeand returns it if the kind isType.Kind.TYPE_VARIABLEThrows an exception otherwise.(package private) Type[]boundArray()java.util.List<Type>bounds()(package private) TypeVariablecopyType(int boundIndex, Type bound)(package private) TypecopyType(AnnotationInstance[] newAnnotations)booleanequals(java.lang.Object o)Compares this Type with another type, and returns true if they are equivalent.inthashCode()Computes a hash code representing this type.(package private) booleanhasImplicitObjectBound()java.lang.Stringidentifier()The identifier of this type variable as it appears in Java source code.Type.Kindkind()Returns the kind of Type this is.(package private) java.lang.StringtoString(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 Detail
-
HASH_MASK
private static final int HASH_MASK
- See Also:
- Constant Field Values
-
IMPLICIT_MASK
private static final int IMPLICIT_MASK
- See Also:
- Constant Field Values
-
name
private final java.lang.String name
-
bounds
private final Type[] bounds
-
hash
private int hash
-
-
Constructor Detail
-
TypeVariable
TypeVariable(java.lang.String name)
-
TypeVariable
TypeVariable(java.lang.String name, Type[] bounds)
-
TypeVariable
TypeVariable(java.lang.String name, Type[] bounds, AnnotationInstance[] annotations)
-
TypeVariable
TypeVariable(java.lang.String name, Type[] bounds, AnnotationInstance[] annotations, boolean implicitObjectBound)
-
-
Method Detail
-
identifier
public java.lang.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
-
bounds
public java.util.List<Type> bounds()
-
boundArray
Type[] boundArray()
-
hasImplicitObjectBound
boolean hasImplicitObjectBound()
-
asTypeVariable
public TypeVariable asTypeVariable()
Description copied from class:TypeCasts this type to aParameterizedTypeand returns it if the kind isType.Kind.TYPE_VARIABLEThrows an exception otherwise.- Overrides:
asTypeVariablein classType- Returns:
- a
ClassType
-
equals
public boolean equals(java.lang.Object o)
Description copied from class:TypeCompares 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
Type copyType(AnnotationInstance[] newAnnotations)
-
copyType
TypeVariable copyType(int boundIndex, Type bound)
-
-