public class ClassExtendsTypeTarget extends PositionBasedTypeTarget
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 be represented as a ClassExtendsTypeTarget with an enclosing target
of the ClassInfo of Foo, and position() would be 0.TypeTarget.UsageAnnotationTarget.Kind| Constructor and Description |
|---|
ClassExtendsTypeTarget(AnnotationTarget enclosingTarget,
Type target,
int position) |
| Modifier and Type | Method and Description |
|---|---|
ClassExtendsTypeTarget |
asClassExtends()
Casts and returns this type target as a
ClassExtendsTypeTarget. |
ClassInfo |
enclosingTarget()
Returns the enclosing target that contains the type referred to by the
TypeTarget.target() method. |
TypeTarget.Usage |
usage()
Returns the kind of usage of this type target.
|
positionannotation, annotations, annotations, annotationsWithRepeatable, asClass, asEmpty, asField, asMethod, asMethodParameter, asMethodParameterType, asRecordComponent, asThrows, asType, asTypeParameter, asTypeParameterBound, declaredAnnotation, declaredAnnotations, declaredAnnotationsWithRepeatable, hasAnnotation, hasDeclaredAnnotation, kind, targetclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitannotation, annotation, annotations, annotations, annotationsWithRepeatable, annotationsWithRepeatable, declaredAnnotation, declaredAnnotation, declaredAnnotationsWithRepeatable, declaredAnnotationsWithRepeatable, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotationpublic ClassExtendsTypeTarget(AnnotationTarget enclosingTarget, Type target, int position)
public final TypeTarget.Usage usage()
TypeTargetgetClass() comparisons.usage in class TypeTargetpublic ClassInfo enclosingTarget()
TypeTargetTypeTarget.target() method.enclosingTarget in class TypeTargetpublic ClassExtendsTypeTarget asClassExtends()
TypeTargetClassExtendsTypeTarget. If this type target
is not a ClassExtendsTypeTarget, then an exception will be thrown.asClassExtends in class TypeTargetClassExtendsTypeTargetCopyright © 2018–2022. All rights reserved.