public final class MethodParameterInfo extends Object implements AnnotationTarget
Thread-Safety
This class is immutable and can be shared between threads without safe publication.AnnotationTarget.Kind| Modifier and Type | Method and Description |
|---|---|
AnnotationInstance |
annotation(DotName name)
Returns the annotation instance with given name declared on this method parameter or any type within
its signature.
|
List<AnnotationInstance> |
annotations()
Returns the annotation instances declared on this method parameter or any type within its signature.
|
List<AnnotationInstance> |
annotations(DotName name)
Returns the annotation instances with given name declared on this method parameter or any type within
its signature.
|
List<AnnotationInstance> |
annotationsWithRepeatable(DotName name,
IndexView index)
Returns the annotation instances with given name declared on this method parameter or any type within
its signature.
|
ClassInfo |
asClass()
Casts and returns this target as a
ClassInfo if it is of kind CLASS |
FieldInfo |
asField()
Casts and returns this target as a
FieldInfo if it is of kind FIELD |
MethodInfo |
asMethod()
Casts and returns this target as a
MethodInfo if it is of kind METHOD |
MethodParameterInfo |
asMethodParameter()
Casts and returns this target as a
MethodParameterInfo if it is of kind METHOD_PARAMETER |
RecordComponentInfo |
asRecordComponent()
Casts and returns this target as a
RecordComponentInfo if it is of kind RECORD_COMPONENT |
TypeTarget |
asType()
Casts and returns this target as a
TypeTarget if it is of kind TYPE |
static MethodParameterInfo |
create(MethodInfo method,
short parameter)
Constructs a new mock method parameter info
|
AnnotationInstance |
declaredAnnotation(DotName name)
Returns the annotation instance with given name declared on this method parameter.
|
List<AnnotationInstance> |
declaredAnnotations()
Returns the annotation instances declared on this method parameter.
|
List<AnnotationInstance> |
declaredAnnotationsWithRepeatable(DotName name,
IndexView index)
Returns the annotation instances with given name declared on this method parameter.
|
boolean |
equals(Object o) |
boolean |
hasAnnotation(DotName name)
Returns whether an annotation instance with given name is declared on this method parameter or any type
within its signature.
|
boolean |
hasDeclaredAnnotation(DotName name)
Returns whether an annotation instance with given name is declared on this method parameter.
|
int |
hashCode() |
AnnotationTarget.Kind |
kind()
Returns the kind of object this target represents.
|
MethodInfo |
method()
Returns the method this parameter belongs to.
|
String |
name()
Returns the name of this parameter, or
null if not known. |
short |
position()
Returns the 0 based position of this parameter.
|
String |
toString()
Returns a string representation describing this method parameter
|
Type |
type()
Returns the type of this parameter.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitannotation, annotation, annotations, annotations, annotationsWithRepeatable, annotationsWithRepeatable, declaredAnnotation, declaredAnnotation, declaredAnnotationsWithRepeatable, declaredAnnotationsWithRepeatable, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotationpublic static MethodParameterInfo create(MethodInfo method, short parameter)
method - the method containing this parameter.parameter - the zero based index of this parameterpublic final MethodInfo method()
public final short position()
public final String name()
null if not known.null if not knownpublic final Type type()
public boolean hasAnnotation(DotName name)
hasAnnotation in interface AnnotationTargetname - name of the annotation type to look for, must not be nulltrue if the annotation is present, false otherwiseannotation(DotName)public AnnotationInstance annotation(DotName name)
target() method of the returned annotation instance may be used to determine
the exact location of the annotation instance.
In case an annotation with given name occurs more than once, the result of this method is not deterministic.
For such situations, annotations(DotName) is preferable.
annotation in interface AnnotationTargetname - name of the annotation type to look for, must not be nullnull if not foundannotations(DotName)public List<AnnotationInstance> annotations(DotName name)
target() method of the returned annotation instances may be used to determine
the exact location of the respective annotation instance.annotations in interface AnnotationTargetname - name of the annotation type, must not be nullnullannotationsWithRepeatable(DotName, IndexView),
annotations()public List<AnnotationInstance> annotationsWithRepeatable(DotName name, IndexView index)
target() method of the returned annotation instances may be used to determine
the exact location of the respective annotation instance.
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the AnnotationInstance.target() returns the target of the container annotation
instance.
annotationsWithRepeatable in interface AnnotationTargetname - name of the annotation type, must not be nullindex - index used to obtain the annotation type, must not be nullnullIllegalArgumentException - if the index is null, if the index does not contain the annotation type
or if name does not identify an annotation typeannotations(DotName),
annotations()public List<AnnotationInstance> annotations()
target() method of the returned annotation instances may be used to determine the exact location
of the respective annotation instance.annotations in interface AnnotationTargetnullpublic boolean hasDeclaredAnnotation(DotName name)
Unlike hasAnnotation(DotName), this method ignores annotations declared on types within
the methor parameter signature.
hasDeclaredAnnotation in interface AnnotationTargetname - name of the annotation type to look for, must not be nulltrue if the annotation is present, false otherwisehasAnnotation(DotName)public AnnotationInstance declaredAnnotation(DotName name)
Unlike annotation(DotName), this method doesn't return annotations declared on types within
the methor parameter signature.
declaredAnnotation in interface AnnotationTargetname - name of the annotation type to look for, must not be nullnull if not foundannotation(DotName)public List<AnnotationInstance> declaredAnnotationsWithRepeatable(DotName name, IndexView index)
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the AnnotationInstance.target() returns the target of the container annotation
instance.
Unlike annotationsWithRepeatable(DotName, IndexView), this method doesn't return annotations
declared on types within the methor parameter signature.
declaredAnnotationsWithRepeatable in interface AnnotationTargetname - name of the annotation type, must not be nullindex - index used to obtain the annotation type, must not be nullnullIllegalArgumentException - if the index is null, if the index does not contain the annotation type
or if name does not identify an annotation typeannotationsWithRepeatable(DotName, IndexView)public List<AnnotationInstance> declaredAnnotations()
Unlike annotations(), this method doesn't return annotations declared on types within
the methor parameter signature.
declaredAnnotations in interface AnnotationTargetnullannotations()public String toString()
public final ClassInfo asClass()
AnnotationTargetClassInfo if it is of kind CLASSasClass in interface AnnotationTargetpublic final FieldInfo asField()
AnnotationTargetFieldInfo if it is of kind FIELDasField in interface AnnotationTargetpublic final MethodInfo asMethod()
AnnotationTargetMethodInfo if it is of kind METHODasMethod in interface AnnotationTargetpublic final MethodParameterInfo asMethodParameter()
AnnotationTargetMethodParameterInfo if it is of kind METHOD_PARAMETERasMethodParameter in interface AnnotationTargetpublic final TypeTarget asType()
AnnotationTargetTypeTarget if it is of kind TYPEasType in interface AnnotationTargetpublic final RecordComponentInfo asRecordComponent()
AnnotationTargetRecordComponentInfo if it is of kind RECORD_COMPONENTasRecordComponent in interface AnnotationTargetpublic AnnotationTarget.Kind kind()
AnnotationTargetkind in interface AnnotationTargetCopyright © 2018–2022. All rights reserved.