Package org.jboss.jandex
Class TypeVariable
java.lang.Object
org.jboss.jandex.Type
org.jboss.jandex.TypeVariable
- All Implemented Interfaces:
Descriptor
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() is the name of the type variable as present in the source code.
For example:
T extends NumberIn this case, the identifier is
T, while the name is java.lang.Number.- Author:
- Jason T. Greene
- Since:
- 2.0
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class org.jboss.jandex.Type
EMPTY_ARRAYFields inherited from interface org.jboss.jandex.Descriptor
NO_SUBSTITUTION -
Method Summary
Modifier and TypeMethodDescriptionCasts this type to aTypeVariableand returns it if the kind isType.Kind.TYPE_VARIABLE.bounds()static TypeVariable.BuilderCreate a builder of a type variable.static TypeVariableCreate an instance of a type variable with the givenidentifier.booleanCompares thisTypewith another type.inthashCode()Computes a hash code representing this type.The identifier of this type variable as it appears in Java source code.kind()Returns the kind of Type this is.name()Returns the name of this type (or its erasure in case of generic types) as aDotName, using theClass.getName()format.Methods inherited from class org.jboss.jandex.Type
annotation, annotations, annotationsWithRepeatable, asArrayType, asClassType, asParameterizedType, asPrimitiveType, asTypeVariableReference, asUnresolvedTypeVariable, asVoidType, asWildcardType, create, createWithAnnotations, descriptor, hasAnnotation, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jboss.jandex.Descriptor
descriptor
-
Method Details
-
create
Create an instance of a type variable with the givenidentifier. The type variable has a single bound ofjava.lang.Object.- Parameters:
identifier- identifier of the type variable- Returns:
- the type variable
- Since:
- 3.1.0
- See Also:
-
builder
Create a builder of a type variable.- Returns:
- the builder
- Since:
- 3.1.0
-
name
Description copied from class:TypeReturns the name of this type (or its erasure in case of generic types) as aDotName, using theClass.getName()format. Specifically:- for primitive types and the void pseudo-type, the corresponding Java keyword
is returned (
void,boolean,byte,short,int,long,float,double,char); - for class types, the binary name of the class is returned;
- for array types, a string is returned that consists of one or more
[characters corresponding to the number of dimensions of the array type, followed by the element type as a single-character code for primitive types orLbinary.name.of.TheClass;for class types (for example,[Iforint[]or[[Ljava.lang.String;forString[][]); - for parameterized types, the binary name of the generic class is returned
(for example,
java.util.ListforList<String>); - for type variables, the name of the first bound of the type variable is returned,
or
java.lang.Objectfor type variables that have no bound; - for wildcard types, the name of the upper bound is returned,
or
java.lang.Objectif the wildcard type does not have an upper bound (for example,java.lang.Numberfor? extends Number).
- for primitive types and the void pseudo-type, the corresponding Java keyword
is returned (
-
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
-
kind
Description copied from class:TypeReturns the kind of Type this is. -
asTypeVariable
Description copied from class:TypeCasts this type to aTypeVariableand returns it if the kind isType.Kind.TYPE_VARIABLE. Throws an exception otherwise.- Overrides:
asTypeVariablein classType- Returns:
- a
TypeVariable
-
equals
Description copied from class:TypeCompares thisTypewith another type. A type is equal to another type if it is of the same kind, and all of their fields are equal. This includes annotations, which must be equal as well. -
hashCode
public int hashCode()Description copied from class:TypeComputes a hash code representing this type.
-