Package org.jboss.jandex
Class TypeParameterBoundTypeTarget
- java.lang.Object
-
- org.jboss.jandex.TypeTarget
-
- org.jboss.jandex.PositionBasedTypeTarget
-
- org.jboss.jandex.TypeParameterTypeTarget
-
- org.jboss.jandex.TypeParameterBoundTypeTarget
-
- All Implemented Interfaces:
AnnotationTarget
public class TypeParameterBoundTypeTarget extends TypeParameterTypeTarget
Represents a type annotation target which occurs within a bound of type parameter type. This class conveys the zero-based position of the parameter, the zeo-based position of the bound, and finally, the enclosing method or class where it occurs. Since type targets can appear at any depth of the type tree at this location, the corresponding type reference is also included.Consider the following example involving a type target using the "Bar" annotation:
public <T extends Number & @Bar Serializable> void foo(List<T>) { ... }
This example would be represented as a
TypeParameterBoundTypeTarget
with an enclosing target of foo'sMethodInfo
, aposition()
value of "0" and aboundPosition()
value of "1". The "Bar" annotation would appear on the type "Serializable" in the bound list of T, on the first type parameter.- Since:
- 2.0
- Author:
- Jason T. Greene
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jboss.jandex.TypeTarget
TypeTarget.Usage
-
Nested classes/interfaces inherited from interface org.jboss.jandex.AnnotationTarget
AnnotationTarget.Kind
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeParameterBoundTypeTarget
asTypeParameterBound()
Casts and returns this type target as aTypeParameterBoundTypeTarget
.int
boundPosition()
Returns the index of the bound this type annotation is within.TypeTarget.Usage
usage()
Returns the kind of usage of this type target.-
Methods inherited from class org.jboss.jandex.TypeParameterTypeTarget
asTypeParameter
-
Methods inherited from class org.jboss.jandex.PositionBasedTypeTarget
position
-
Methods inherited from class org.jboss.jandex.TypeTarget
asClass, asClassExtends, asEmpty, asField, asMethod, asMethodParameter, asMethodParameterType, asRecordComponent, asThrows, asType, enclosingTarget, kind, target
-
-
-
-
Method Detail
-
boundPosition
public final int boundPosition()
Returns the index of the bound this type annotation is within.- Returns:
- the index of the bound this type annotation is within
-
usage
public final TypeTarget.Usage usage()
Description copied from class:TypeTarget
Returns the kind of usage of this type target. This allows a caller to use a switch statement as opposed togetClass()
comparisons.- Overrides:
usage
in classTypeParameterTypeTarget
- Returns:
- the kind of usage of this type target
-
asTypeParameterBound
public TypeParameterBoundTypeTarget asTypeParameterBound()
Description copied from class:TypeTarget
Casts and returns this type target as aTypeParameterBoundTypeTarget
. If this type target is not aTypeParameterBoundTypeTarget
, then an exception will be thrown.- Overrides:
asTypeParameterBound
in classTypeTarget
- Returns:
- an instance of
TypeParameterBoundTypeTarget
-
-