Top Description Inners Fields Constructors Methods
org.jboss.jandex

public final Class TypeVariable

extends Type
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .List, .Objects

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 Number
In this case, the identifier is T, while the name is java.lang.Number.
Author
Jason T. Greene
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
TypeVariable.Builder

Convenient builder for TypeVariable.

Field Summary

Modifier and TypeField and Description
private final Type[]
private int
private static final int
private final String
private static final int
Inherited from org.jboss.jandex.Type:
EMPTY_ARRAY

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
TypeVariable(String name, Type[] bounds)

pack-priv
TypeVariable(String name, Type[] bounds, AnnotationInstance[] annotations)

pack-priv
TypeVariable(String name, Type[] bounds, AnnotationInstance[] annotations, boolean implicitObjectBound)

Method Summary

Modifier and TypeMethod and Description
public TypeVariable
asTypeVariable()

Overrides org.jboss.jandex.Type.asTypeVariable.

Casts this type to a org.jboss.jandex.TypeVariable and returns it if the kind is Kind#TYPE_VARIABLE.
pack-priv Type[]
public List<Type>
public static TypeVariable.Builder

Returns:

the builder
builder
(String identifier)

Create a builder of a type variable.

pack-priv Type
copyType(AnnotationInstance[] newAnnotations)

Implements abstract org.jboss.jandex.Type.copyType.

pack-priv TypeVariable
copyType(int boundIndex, Type bound)

public static TypeVariable

Returns:

the type variable
create
(String
identifier of the type variable
identifier
)

Create an instance of a type variable with the given identifier.

public boolean
equals(Object
the type to compare to
o
)

Overrides org.jboss.jandex.Type.equals.

Compares this Type with another type.
public int
hashCode()

Overrides org.jboss.jandex.Type.hashCode.

Computes a hash code representing this type.
pack-priv boolean
public String

Returns:

the identifier of this type variable
identifier
()

The identifier of this type variable as it appears in Java source code.

pack-priv boolean
pack-priv int
public Type.Kind
kind()

Implements abstract org.jboss.jandex.Type.kind.

Returns the kind of Type this is.
public DotName
name()

Overrides org.jboss.jandex.Type.name.

Returns the name of this type (or its erasure in case of generic types) as a DotName, using the Class#getName() format.
pack-priv String
toString(boolean simple)

Overrides org.jboss.jandex.Type.toString.

Inherited from org.jboss.jandex.Type:
addAnnotationannotationannotationArrayannotationsannotationsWithRepeatableappendAnnotationsasArrayTypeasClassTypeasParameterizedTypeasPrimitiveTypeasTypeVariableReferenceasUnresolvedTypeVariableasVoidTypeasWildcardTypecreatecreateWithAnnotationsdescriptorhasAnnotationtoString

Field Detail

boundsback to summary
private final Type[] bounds
hashback to summary
private int hash
HASH_MASKback to summary
private static final int HASH_MASK
identifierback to summary
private final String identifier
IMPLICIT_MASKback to summary
private static final int IMPLICIT_MASK

Constructor Detail

TypeVariableback to summary
pack-priv TypeVariable(String name)
TypeVariableback to summary
pack-priv TypeVariable(String name, Type[] bounds)
TypeVariableback to summary
pack-priv TypeVariable(String name, Type[] bounds, AnnotationInstance[] annotations)
TypeVariableback to summary
pack-priv TypeVariable(String name, Type[] bounds, AnnotationInstance[] annotations, boolean implicitObjectBound)

Method Detail

asTypeVariableback to summary
public TypeVariable asTypeVariable()

Overrides org.jboss.jandex.Type.asTypeVariable.

Doc from org.jboss.jandex.Type.asTypeVariable.

Casts this type to a org.jboss.jandex.TypeVariable and returns it if the kind is Kind#TYPE_VARIABLE. Throws an exception otherwise.

Returns:TypeVariable

a TypeVariable

Annotations
@Override
boundArrayback to summary
pack-priv Type[] boundArray()
boundsback to summary
public List<Type> bounds()
builderback to summary
public static TypeVariable.Builder builder(String identifier)

Create a builder of a type variable.

Returns:TypeVariable.Builder

the builder

Since
3.1.0
copyTypeback to summary
pack-priv Type copyType(AnnotationInstance[] newAnnotations)

Implements abstract org.jboss.jandex.Type.copyType.

Annotations
@Override
copyTypeback to summary
pack-priv TypeVariable copyType(int boundIndex, Type bound)
createback to summary
public static TypeVariable create(String identifier)

Create an instance of a type variable with the given identifier. The type variable has a single bound of java.lang.Object.

Parameters
identifier:String

identifier of the type variable

Returns:TypeVariable

the type variable

Since
3.1.0
See Also
identifier()
equalsback to summary
public boolean equals(Object o)

Overrides org.jboss.jandex.Type.equals.

Doc from org.jboss.jandex.Type.equals.

Compares this Type with 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.

Parameters
o:Object

the type to compare to

Returns:boolean

true if equal

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides org.jboss.jandex.Type.hashCode.

Doc from org.jboss.jandex.Type.hashCode.

Computes a hash code representing this type.

Returns:int

the hash code

Annotations
@Override
hasImplicitObjectBoundback to summary
pack-priv boolean hasImplicitObjectBound()
identifierback to summary
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:String

the identifier of this type variable

internEqualsback to summary
pack-priv boolean internEquals(Object o)

Overrides org.jboss.jandex.Type.internEquals.

Annotations
@Override
internHashCodeback to summary
pack-priv int internHashCode()

Overrides org.jboss.jandex.Type.internHashCode.

Annotations
@Override
kindback to summary
public Type.Kind kind()

Implements abstract org.jboss.jandex.Type.kind.

Doc from org.jboss.jandex.Type.kind.

Returns the kind of Type this is.

Returns:Type.Kind

the kind

Annotations
@Override
nameback to summary
public DotName name()

Overrides org.jboss.jandex.Type.name.

Doc from org.jboss.jandex.Type.name.

Returns the name of this type (or its erasure in case of generic types) as a DotName, using the Class#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 or Lbinary.name.of.TheClass; for class types (for example, [I for int[] or [[Ljava.lang.String; for String[][]);
  • for parameterized types, the binary name of the generic class is returned (for example, java.util.List for List<String>);
  • for type variables, the name of the first bound of the type variable is returned, or java.lang.Object for type variables that have no bound;
  • for wildcard types, the name of the upper bound is returned, or java.lang.Object if the wildcard type does not have an upper bound (for example, java.lang.Number for ? extends Number).
Returns:DotName

the name of this type (or its erasure in case of generic types)

Annotations
@Override
toStringback to summary
pack-priv String toString(boolean simple)

Overrides org.jboss.jandex.Type.toString.

Annotations
@Override
org.jboss.jandex back to summary

public final Class TypeVariable.Builder

extends Type.Builder<TypeVariable.Builder>
Class Inheritance

Convenient builder for TypeVariable. If no bound is added, the built type variable will have a single bound of java.lang.Object.
Since
3.1.0

Field Summary

Modifier and TypeField and Description
private final List<Type>
private final String
Inherited from org.jboss.jandex.Type.Builder:
annotationsname

Constructor Summary

AccessConstructor and Description
pack-priv
Builder(String identifier)

Method Summary

Modifier and TypeMethod and Description
public TypeVariable.Builder

Returns:

this builder
addBound
(Type
the bound, must not be null
bound
)

Adds a bound.

public TypeVariable.Builder

Returns:

this builder
addBound
(Class<?>
the class whose type is added as a bound, must not be null
clazz
)

Adds a bound.

public TypeVariable

Returns:

the built type variable
build
()

Returns the built type variable.

Inherited from org.jboss.jandex.Type.Builder:
addAnnotationannotationsArrayself

Field Detail

boundsback to summary
private final List<Type> bounds
identifierback to summary
private final String identifier

Constructor Detail

Builderback to summary
pack-priv Builder(String identifier)

Method Detail

addBoundback to summary
public TypeVariable.Builder addBound(Type bound)

Adds a bound.

Parameters
bound:Type

the bound, must not be null

Returns:TypeVariable.Builder

this builder

addBoundback to summary
public TypeVariable.Builder addBound(Class<?> clazz)

Adds a bound.

Parameters
clazz:Class<?>

the class whose type is added as a bound, must not be null

Returns:TypeVariable.Builder

this builder

buildback to summary
public TypeVariable build()

Returns the built type variable.

Returns:TypeVariable

the built type variable