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
Represents a target of type annotation which occurs within a bound of type parameter.
This class conveys the zero-based position of the type parameter, the zero-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> l) { ... }
This example would be represented as a TypeParameterBoundTypeTarget
with an enclosing target
of the MethodInfo
of foo
, position()
would be 0 and boundPosition()
would be 1.
- Since:
- 2.0
-
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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTypeParameterBoundTypeTarget
(AnnotationTarget enclosingTarget, int position, int boundPosition) TypeParameterBoundTypeTarget
(AnnotationTarget enclosingTarget, Type target, int position, int boundPosition) -
Method Summary
Modifier and TypeMethodDescription(package private) void
Casts and returns this type target as aTypeParameterBoundTypeTarget
.final int
Returns the index of the bound this type annotation is within.final 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
annotation, annotations, annotations, annotationsWithRepeatable, asClass, asClassExtends, asDeclaration, asEmpty, asField, asMethod, asMethodParameter, asMethodParameterType, asRecordComponent, asThrows, asType, declaredAnnotation, declaredAnnotations, declaredAnnotationsWithRepeatable, enclosingTarget, hasAnnotation, hasDeclaredAnnotation, isDeclaration, kind, setTarget, target
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jboss.jandex.AnnotationTarget
annotation, annotation, annotations, annotations, annotationsWithRepeatable, annotationsWithRepeatable, declaredAnnotation, declaredAnnotation, declaredAnnotationsWithRepeatable, declaredAnnotationsWithRepeatable, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation
-
Field Details
-
boundPosition
private short boundPosition -
adjusted
private boolean adjusted
-
-
Constructor Details
-
TypeParameterBoundTypeTarget
TypeParameterBoundTypeTarget(AnnotationTarget enclosingTarget, int position, int boundPosition) -
TypeParameterBoundTypeTarget
TypeParameterBoundTypeTarget(AnnotationTarget enclosingTarget, Type target, int position, int boundPosition)
-
-
Method Details
-
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
-
adjustBoundDown
void adjustBoundDown() -
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
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
-