Package org.jboss.jandex
Class MethodParameterTypeTarget
java.lang.Object
org.jboss.jandex.TypeTarget
org.jboss.jandex.PositionBasedTypeTarget
org.jboss.jandex.MethodParameterTypeTarget
- All Implemented Interfaces:
AnnotationTarget
Represents a type annotation target which occurs within a method parameter type. This class conveys
the enclosing method and the zero-based position of the parameter. 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 void foo(List<@Bar T> { ... }
This example would be represented as a MethodParameterTypeTarget
with an enclosing target
of foo's MethodInfo
, and position()
would return 0. The "Bar" annotation
would appear on 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
ConstructorsConstructorDescriptionMethodParameterTypeTarget
(AnnotationTarget enclosingTarget, Type target, int position) MethodParameterTypeTarget
(MethodInfo enclosingTarget, int position) -
Method Summary
Modifier and TypeMethodDescriptionCasts and returns this type target as aMethodParameterTypeTarget
.Returns the enclosing target that contains the type referred to by theTypeTarget.target()
method.final 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, asClassExtends, asEmpty, asField, asMethod, asMethodParameter, asRecordComponent, asThrows, asType, asTypeParameter, asTypeParameterBound, kind, setTarget, target
-
Constructor Details
-
MethodParameterTypeTarget
MethodParameterTypeTarget(MethodInfo enclosingTarget, int position) -
MethodParameterTypeTarget
MethodParameterTypeTarget(AnnotationTarget enclosingTarget, Type target, int position)
-
-
Method Details
-
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
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
-
asMethodParameterType
Description copied from class:TypeTarget
Casts and returns this type target as aMethodParameterTypeTarget
. If this type target is not aMethodParameterTypeTarget
, then an exception will be thrown.- Overrides:
asMethodParameterType
in classTypeTarget
- Returns:
- an instance of
MethodParameterTypeTarget
-