Package org.jboss.jandex
Class EmptyTypeTarget
java.lang.Object
org.jboss.jandex.TypeTarget
org.jboss.jandex.EmptyTypeTarget
- All Implemented Interfaces:
AnnotationTarget
Represents a type annotation target 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 "Bar" annotation:
public List<@Bar T> foo { return foo; }This example would be represented as an
EmptyTypeTarget
with an enclosing target of Foo's
MethodInfo
, and isReceiver
would return false.-
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
ConstructorsConstructorDescriptionEmptyTypeTarget
(AnnotationTarget enclosingTarget, boolean receiver) EmptyTypeTarget
(AnnotationTarget enclosingTarget, Type target, boolean receiver) -
Method Summary
Modifier and TypeMethodDescriptionasEmpty()
boolean
Returns whether the type occurs within a method receiver (the "this" reference the method receives).final TypeTarget.Usage
usage()
Returns the kind of usage of this type target.Methods inherited from class org.jboss.jandex.TypeTarget
asClass, asClassExtends, asField, asMethod, asMethodParameter, asMethodParameterType, asRecordComponent, asThrows, asType, asTypeParameter, asTypeParameterBound, enclosingTarget, kind, setTarget, target
-
Field Details
-
receiver
private boolean receiver
-
-
Constructor Details
-
EmptyTypeTarget
EmptyTypeTarget(AnnotationTarget enclosingTarget, boolean receiver) -
EmptyTypeTarget
EmptyTypeTarget(AnnotationTarget enclosingTarget, Type target, boolean receiver)
-
-
Method Details
-
isReceiver
public boolean isReceiver()Returns whether the type occurs within a method receiver (the "this" reference the method receives). It will return false if the type occurs within a method return, or a field.- Returns:
- true if occurs within a method receiver, otherwise false
-
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
-
asEmpty
- Overrides:
asEmpty
in classTypeTarget
-