Package org.jboss.jandex
Class ClassExtendsTypeTarget
- java.lang.Object
-
- org.jboss.jandex.TypeTarget
-
- org.jboss.jandex.PositionBasedTypeTarget
-
- org.jboss.jandex.ClassExtendsTypeTarget
-
- All Implemented Interfaces:
AnnotationTarget
public class ClassExtendsTypeTarget extends PositionBasedTypeTarget
Represents a type annotation target which occurs in the extends or implements clause of an enclosing class. This class conveys the enclosing class definition, as well as a position to indicate the interface or superclass this target applies to. Since type targets can appear at any depth of the type tree at this location, the corresponding type reference is also included.The special position 65535 is used to indicate the type usage is on the super type in the extends clause. All other numbers denote the zero-based offset in the interface list of the implements clause.
Consider the following example involving a type target using the "Bar" annotation:
class Foo<T> implements List<@Bar T> {}
This example would return a position of 1 (marking the first interface), an enclosing target of theClassInfo
representing "Foo", and a target type of the type variable "T".- 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
-
-
Constructor Summary
Constructors Constructor Description ClassExtendsTypeTarget(AnnotationTarget enclosingTarget, Type target, int position)
ClassExtendsTypeTarget(ClassInfo enclosingTarget, int position)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassExtendsTypeTarget
asClassExtends()
Casts and returns this type target as aClassExtendsTypeTarget
.ClassInfo
enclosingTarget()
Returns the enclosing target that contains the type referred to by theTypeTarget.target()
method.TypeTarget.Usage
usage()
Returns the kind of usage of this type target.-
Methods inherited from class org.jboss.jandex.PositionBasedTypeTarget
adjustUp, position
-
Methods inherited from class org.jboss.jandex.TypeTarget
asClass, asEmpty, asField, asMethod, asMethodParameter, asMethodParameterType, asRecordComponent, asThrows, asType, asTypeParameter, asTypeParameterBound, kind, setTarget, target
-
-
-
-
Constructor Detail
-
ClassExtendsTypeTarget
ClassExtendsTypeTarget(ClassInfo enclosingTarget, int position)
-
ClassExtendsTypeTarget
public ClassExtendsTypeTarget(AnnotationTarget enclosingTarget, Type target, int position)
-
-
Method Detail
-
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.- Specified by:
usage
in classTypeTarget
- Returns:
- the kind of usage of this type target
-
enclosingTarget
public ClassInfo enclosingTarget()
Description copied from class:TypeTarget
Returns the enclosing target that contains the type referred to by theTypeTarget.target()
method.- Overrides:
enclosingTarget
in classTypeTarget
- Returns:
- the enclosing target
-
asClassExtends
public ClassExtendsTypeTarget asClassExtends()
Description copied from class:TypeTarget
Casts and returns this type target as aClassExtendsTypeTarget
. If this type target is not aClassExtendsTypeTarget
, then an exception will be thrown.- Overrides:
asClassExtends
in classTypeTarget
- Returns:
- an instance of
ClassExtendsTypeTarget
-
-