Top Description Fields Constructors Methods
org.jboss.jandex

public final Class MethodParameterInfo

extends Object
implements Declaration
Class Inheritance
All Implemented Interfaces
org.jboss.jandex.Declaration, org.jboss.jandex.AnnotationTarget
Imports
java.util.ArrayList, .Collections, .List

Represents an individual Java method parameter that was annotated.

Thread-Safety

This class is immutable and can be shared between threads without safe publication.
Author
Jason T. Greene

Field Summary

Modifier and TypeField and Description
private final MethodInfo
private final short

Constructor Summary

AccessConstructor and Description
pack-priv
MethodParameterInfo(MethodInfo method, short position)

Method Summary

Modifier and TypeMethod and Description
public AnnotationInstance

Returns:

the annotation instance, or null if not found
annotation
(DotName
name of the annotation type to look for, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.annotation.

Returns the annotation instance with given name declared on this method parameter or any type within its signature.
public List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
annotations
(DotName
name of the annotation type, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.annotations.

Returns the annotation instances with given name declared on this method parameter or any type within its signature.
public List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
annotations
()

Implements org.jboss.jandex.AnnotationTarget.annotations.

Returns the annotation instances declared on this method parameter or any type within its signature.
public List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
annotationsWithRepeatable
(DotName
name of the annotation type, must not be null
name
,
IndexView
index used to obtain the annotation type, must not be null
index
)

Implements org.jboss.jandex.AnnotationTarget.annotationsWithRepeatable.

Returns the annotation instances with given name declared on this method parameter or any type within its signature.
public final ClassInfo
asClass()

Implements org.jboss.jandex.AnnotationTarget.asClass.

Casts and returns this target as a ClassInfo if it is of kind CLASS
public final FieldInfo
asField()

Implements org.jboss.jandex.AnnotationTarget.asField.

Casts and returns this target as a FieldInfo if it is of kind FIELD
public final MethodInfo
asMethod()

Implements org.jboss.jandex.AnnotationTarget.asMethod.

Casts and returns this target as a MethodInfo if it is of kind METHOD
public final MethodParameterInfo
asMethodParameter()

Implements org.jboss.jandex.AnnotationTarget.asMethodParameter.

Casts and returns this target as a MethodParameterInfo if it is of kind METHOD_PARAMETER
public final RecordComponentInfo
asRecordComponent()

Implements org.jboss.jandex.AnnotationTarget.asRecordComponent.

Casts and returns this target as a RecordComponentInfo if it is of kind RECORD_COMPONENT
public final TypeTarget
asType()

Implements org.jboss.jandex.AnnotationTarget.asType.

Casts and returns this target as a TypeTarget if it is of kind TYPE
public static MethodParameterInfo

Returns:

the new mock parameter info
create
(MethodInfo
the method containing this parameter.
method
,
short
the zero based index of this parameter
parameter
)

Constructs a new mock method parameter info

public AnnotationInstance

Returns:

the annotation instance, or null if not found
declaredAnnotation
(DotName
name of the annotation type to look for, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotation.

Returns the annotation instance with given name declared on this method parameter.
public List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
declaredAnnotations
()

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotations.

Returns the annotation instances declared on this method parameter.
public List<AnnotationInstance>

Returns:

immutable list of annotation instances, never null
declaredAnnotationsWithRepeatable
(DotName
name of the annotation type, must not be null
name
,
IndexView
index used to obtain the annotation type, must not be null
index
)

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotationsWithRepeatable.

Returns the annotation instances with given name declared on this method parameter.
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public boolean

Returns:

true if the annotation is present, false otherwise
hasAnnotation
(DotName
name of the annotation type to look for, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.hasAnnotation.

Returns whether an annotation instance with given name is declared on this method parameter or any type within its signature.
public boolean

Returns:

true if the annotation is present, false otherwise
hasDeclaredAnnotation
(DotName
name of the annotation type to look for, must not be null
name
)

Implements org.jboss.jandex.AnnotationTarget.hasDeclaredAnnotation.

Returns whether an annotation instance with given name is declared on this method parameter.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public AnnotationTarget.Kind
kind()

Implements org.jboss.jandex.AnnotationTarget.kind.

Returns the kind of object this target represents.
public final MethodInfo

Returns:

the declaring Java method
method
()

Returns the method this parameter belongs to.

public final String

Returns:

the name of this parameter, or null if not known
name
()

Returns the name of this parameter, or null if not known.

public final short

Returns:

the position of this parameter
position
()

Returns the 0 based position of this parameter.

private boolean
private boolean
public String

Returns:

a string representation of this method parameter
toString
()

Overrides java.lang.Object.toString.

Returns a string representation describing this method parameter.
public final Type

Returns:

the type of this parameter
type
()

Returns the type of this parameter.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

methodback to summary
private final MethodInfo method
positionback to summary
private final short position

Constructor Detail

MethodParameterInfoback to summary
pack-priv MethodParameterInfo(MethodInfo method, short position)

Method Detail

annotationback to summary
public AnnotationInstance annotation(DotName name)

Implements org.jboss.jandex.AnnotationTarget.annotation.

Returns the annotation instance with given name declared on this method parameter or any type within its signature. The 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.

Parameters
name:DotName

name of the annotation type to look for, must not be null

Returns:AnnotationInstance

the annotation instance, or null if not found

Annotations
@Override
Since
3.0
See Also
annotations(DotName)
annotationsback to summary
public List<AnnotationInstance> annotations(DotName name)

Implements org.jboss.jandex.AnnotationTarget.annotations.

Returns the annotation instances with given name declared on this method parameter or any type within its signature. The target() method of the returned annotation instances may be used to determine the exact location of the respective annotation instance.

Parameters
name:DotName

name of the annotation type, must not be null

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

Annotations
@Override
Since
3.0
See Also
annotationsWithRepeatable(DotName, IndexView), annotations()
annotationsback to summary
public List<AnnotationInstance> annotations()

Implements org.jboss.jandex.AnnotationTarget.annotations.

Returns the annotation instances declared on this method parameter or any type within its signature. The target() method of the returned annotation instances may be used to determine the exact location of the respective annotation instance.

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

Annotations
@Override
Since
3.0
annotationsWithRepeatableback to summary
public List<AnnotationInstance> annotationsWithRepeatable(DotName name, IndexView index)

Implements org.jboss.jandex.AnnotationTarget.annotationsWithRepeatable.

Returns the annotation instances with given name declared on this method parameter or any type within its signature. The 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.

Parameters
name:DotName

name of the annotation type, must not be null

index:IndexView

index used to obtain the annotation type, must not be null

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

Annotations
@Override
Exceptions
IllegalArgumentException:
if the index is null, if the index does not contain the annotation type or if name does not identify an annotation type
Since
3.0
See Also
annotations(DotName), annotations()
asClassback to summary
public final ClassInfo asClass()

Implements org.jboss.jandex.AnnotationTarget.asClass.

Doc from org.jboss.jandex.AnnotationTarget.asClass.

Casts and returns this target as a ClassInfo if it is of kind CLASS

Returns:ClassInfo

this instance cast to a class

Annotations
@Override
asFieldback to summary
public final FieldInfo asField()

Implements org.jboss.jandex.AnnotationTarget.asField.

Doc from org.jboss.jandex.AnnotationTarget.asField.

Casts and returns this target as a FieldInfo if it is of kind FIELD

Returns:FieldInfo

this instance cast to a field

Annotations
@Override
asMethodback to summary
public final MethodInfo asMethod()

Implements org.jboss.jandex.AnnotationTarget.asMethod.

Doc from org.jboss.jandex.AnnotationTarget.asMethod.

Casts and returns this target as a MethodInfo if it is of kind METHOD

Returns:MethodInfo

this instance cast to a method

Annotations
@Override
asMethodParameterback to summary
public final MethodParameterInfo asMethodParameter()

Implements org.jboss.jandex.AnnotationTarget.asMethodParameter.

Doc from org.jboss.jandex.AnnotationTarget.asMethodParameter.

Casts and returns this target as a MethodParameterInfo if it is of kind METHOD_PARAMETER

Returns:MethodParameterInfo

this instance cast to a method parameter

Annotations
@Override
asRecordComponentback to summary
public final RecordComponentInfo asRecordComponent()

Implements org.jboss.jandex.AnnotationTarget.asRecordComponent.

Doc from org.jboss.jandex.AnnotationTarget.asRecordComponent.

Casts and returns this target as a RecordComponentInfo if it is of kind RECORD_COMPONENT

Returns:RecordComponentInfo

this instance cast to a record component

Annotations
@Override
asTypeback to summary
public final TypeTarget asType()

Implements org.jboss.jandex.AnnotationTarget.asType.

Doc from org.jboss.jandex.AnnotationTarget.asType.

Casts and returns this target as a TypeTarget if it is of kind TYPE

Returns:TypeTarget

this instance cast to a type target

Annotations
@Override
createback to summary
public static MethodParameterInfo create(MethodInfo method, short parameter)

Constructs a new mock method parameter info

Parameters
method:MethodInfo

the method containing this parameter.

parameter:short

the zero based index of this parameter

Returns:MethodParameterInfo

the new mock parameter info

declaredAnnotationback to summary
public AnnotationInstance declaredAnnotation(DotName name)

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotation.

Returns the annotation instance with given name declared on this method parameter.

Unlike annotation(DotName), this method doesn't return annotations declared on types within the methor parameter signature.

Parameters
name:DotName

name of the annotation type to look for, must not be null

Returns:AnnotationInstance

the annotation instance, or null if not found

Annotations
@Override
Since
3.0
See Also
annotation(DotName)
declaredAnnotationsback to summary
public List<AnnotationInstance> declaredAnnotations()

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotations.

Returns the annotation instances declared on this method parameter.

Unlike annotations(), this method doesn't return annotations declared on types within the methor parameter signature.

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

Annotations
@Override
Since
3.0
See Also
annotations()
declaredAnnotationsWithRepeatableback to summary
public List<AnnotationInstance> declaredAnnotationsWithRepeatable(DotName name, IndexView index)

Implements org.jboss.jandex.AnnotationTarget.declaredAnnotationsWithRepeatable.

Returns the annotation instances with given name declared on this method parameter.

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.

Parameters
name:DotName

name of the annotation type, must not be null

index:IndexView

index used to obtain the annotation type, must not be null

Returns:List<AnnotationInstance>

immutable list of annotation instances, never null

Annotations
@Override
Exceptions
IllegalArgumentException:
if the index is null, if the index does not contain the annotation type or if name does not identify an annotation type
Since
3.0
See Also
annotationsWithRepeatable(DotName, IndexView)
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hasAnnotationback to summary
public boolean hasAnnotation(DotName name)

Implements org.jboss.jandex.AnnotationTarget.hasAnnotation.

Returns whether an annotation instance with given name is declared on this method parameter or any type within its signature.

Parameters
name:DotName

name of the annotation type to look for, must not be null

Returns:boolean

true if the annotation is present, false otherwise

Annotations
@Override
Since
3.0
See Also
annotation(DotName)
hasDeclaredAnnotationback to summary
public boolean hasDeclaredAnnotation(DotName name)

Implements org.jboss.jandex.AnnotationTarget.hasDeclaredAnnotation.

Returns whether an annotation instance with given name is declared on this method parameter.

Unlike hasAnnotation(DotName), this method ignores annotations declared on types within the methor parameter signature.

Parameters
name:DotName

name of the annotation type to look for, must not be null

Returns:boolean

true if the annotation is present, false otherwise

Annotations
@Override
Since
3.0
See Also
hasAnnotation(DotName)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
kindback to summary
public AnnotationTarget.Kind kind()

Implements org.jboss.jandex.AnnotationTarget.kind.

Doc from org.jboss.jandex.AnnotationTarget.kind.

Returns the kind of object this target represents.

Returns:AnnotationTarget.Kind

the target kind.

Annotations
@Override
methodback to summary
public final MethodInfo method()

Returns the method this parameter belongs to.

Returns:MethodInfo

the declaring Java method

nameback to summary
public final String name()

Returns the name of this parameter, or null if not known.

Returns:String

the name of this parameter, or null if not known

positionback to summary
public final short position()

Returns the 0 based position of this parameter.

Returns:short

the position of this parameter

targetsThisback to summary
private boolean targetsThis(AnnotationInstance annotation)
targetsThisOrNestedback to summary
private boolean targetsThisOrNested(AnnotationInstance annotation)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation describing this method parameter. It is similar although not necessarily identical to a Java source code declaration of this method parameter.

Returns:String

a string representation of this method parameter

typeback to summary
public final Type type()

Returns the type of this parameter.

Returns:Type

the type of this parameter

Since
3.0