Package org.jboss.jandex
Class EmptyTypeTarget
- java.lang.Object
-
- org.jboss.jandex.TypeTarget
-
- org.jboss.jandex.EmptyTypeTarget
-
- All Implemented Interfaces:
AnnotationTarget
public class EmptyTypeTarget extends TypeTarget
Represents a target of type annotation which occurs directly on a field type, a method return type, or a method receiver type. This class conveys the enclosing field or method, and if a method, also differentiates between the receiver and return value. 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
Barannotation:public List<@Bar T> foo() { ... }This example would be represented as anEmptyTypeTargetwith an enclosing target of theMethodInfooffoo, andisReceiver()would befalse.
-
-
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 Modifier and Type Field Description private booleanreceiver
-
Constructor Summary
Constructors Constructor Description EmptyTypeTarget(AnnotationTarget enclosingTarget, boolean receiver)EmptyTypeTarget(AnnotationTarget enclosingTarget, Type target, boolean receiver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EmptyTypeTargetasEmpty()booleanisReceiver()Returns whether the annotated type occurs within a method receiver (thethisreference the method receives).TypeTarget.Usageusage()Returns the kind of usage of this type target.-
Methods inherited from class org.jboss.jandex.TypeTarget
annotation, annotations, annotations, annotationsWithRepeatable, asClass, asClassExtends, asDeclaration, asField, asMethod, asMethodParameter, asMethodParameterType, asRecordComponent, asThrows, asType, asTypeParameter, asTypeParameterBound, 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
-
-
-
-
Constructor Detail
-
EmptyTypeTarget
EmptyTypeTarget(AnnotationTarget enclosingTarget, boolean receiver)
-
EmptyTypeTarget
EmptyTypeTarget(AnnotationTarget enclosingTarget, Type target, boolean receiver)
-
-
Method Detail
-
isReceiver
public boolean isReceiver()
Returns whether the annotated type occurs within a method receiver (thethisreference the method receives). It will returnfalseif the type occurs in a method return type or in a field type.- Returns:
trueif the annotated type occurs within a method receiver type, otherwisefalse
-
usage
public final TypeTarget.Usage usage()
Description copied from class:TypeTargetReturns the kind of usage of this type target. This allows a caller to use a switch statement as opposed togetClass()comparisons.- Specified by:
usagein classTypeTarget- Returns:
- the kind of usage of this type target
-
asEmpty
public EmptyTypeTarget asEmpty()
- Overrides:
asEmptyin classTypeTarget
-
-