Jandex makes reasonable attempts to not include implicitly declared (aka mandated)
and synthetic parameters in parameters(), parameterTypes(),
parameterName(int), parameterType(int) and parametersCount().
However, descriptorParameterTypes() and descriptorParametersCount()
may be used to obtain information about all parameters, including mandated and synthetic.
As an exception to the rule above, in case of well known methods where no parameter is declared explicitly, the implicitly declared parameters are included. This currently applies to the implicitly declared parameters of:
valueOf() method in enums;Thread-Safety
This class is immutable and can be shared between threads without safe publication.| Modifier and Type | Field and Description |
|---|---|
| private ClassInfo | |
| pack-priv static final String[] | |
| private MethodInternal |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | |
| pack-priv | MethodInfo(ClassInfo clazz, byte[] name, byte[][] parameterNames, Type[] parameterTypes, Type returnType, short flags)
|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public final AnnotationInstance | Returns: the annotation instance, ornull if not foundname of the annotation type to look for, must not be name)nullImplements org. |
| public final List | Returns: immutable list of annotation instances, nevernullname of the annotation type, must not be name)nullImplements org. |
| public final List | Returns: immutable list of annotation instances, nevernullImplements org. |
| public final List | Returns: immutable list of annotation instances, nevernullname of the annotation type, must not be name, IndexView nullindex used to obtain the annotation type, must not be index)nullImplements org. |
| public final Type[] | Returns: an array copy contain parameter types
Deprecated
use
Returns an array of parameter types in declaration order.
parameterTypes()
|
| public final ClassInfo | asClass()
Implements org. ClassInfo if it is of kind CLASS
|
| public final FieldInfo | asField()
Implements org. FieldInfo if it is of kind FIELD
|
| public final MethodInfo | asMethod()
Implements org. MethodInfo if it is of kind METHOD
|
| public final MethodParameterInfo | asMethodParameter()
Implements org. MethodParameterInfo if it is of kind METHOD_PARAMETER
|
| public final RecordComponentInfo | asRecordComponent()
Implements org. RecordComponentInfo if it is of kind RECORD_COMPONENT
|
| public final TypeTarget | asType()
Implements org. TypeTarget if it is of kind TYPE
|
| pack-priv final Type[] | |
| pack-priv final Type[] | |
| public static MethodInfo | Returns: a mock methodthe class declaring the field clazz, String the name of the field name, Type[] a read only array containing the types of each parameter in parameter order parameterTypes, Type the return value type returnType, short the method attributes flags)Construct a new mock Method instance. |
| public static MethodInfo | Returns: a mock methodthe class declaring the field clazz, String the name of the field name, Type[] a read only array containing the types of each parameter in parameter order parameterTypes, Type the return value type returnType, short the method attributes flags, TypeVariable[] the generic type parameters for this method typeParameters, Type[] the exceptions declared as thrown by this method exceptions)Construct a new mock Method instance. |
| public static MethodInfo | Returns: a mock methodthe class declaring the field clazz, String the name of the field name, String[] the names of the method parameter parameterNames, Type[] a read only array containing the types of each parameter in parameter order parameterTypes, Type the return value type returnType, short the method attributes flags, TypeVariable[] the generic type parameters for this method typeParameters, Type[] the exceptions declared as thrown by this method exceptions)Construct a new mock Method instance. |
| public AnnotationInstance | Returns: the annotation instance, ornull if not foundname of the annotation type to look for, must not be name)nullImplements org. |
| public List | Returns: immutable list of annotation instances, nevernullImplements org. |
| public List | Returns: immutable list of annotation instances, nevernullname of the annotation type, must not be name, IndexView nullindex used to obtain the annotation type, must not be index)nullImplements org. |
| public final ClassInfo | |
| public AnnotationValue | Returns: default annotation value if available, otherwise nullReturns the default annotation value if this method represents an annotation member with a default value. |
| public String | Returns: the bytecode descriptor of this methoda substitution function from type variable identifiers to types typeVariableSubstitution)Implements org. |
| public final int | Returns: the number of all parameters present on this methodReturns the number of all parameters present on this method, based on the method descriptor. |
| public final List | descriptorParameterTypes()
Returns a list of types of all parameters present on this method, based on the method descriptor. |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| public final List | Returns: immutable list of throwable classes thrown by this methodReturns the list of throwable classes declared to be thrown by this method. |
| public final short | |
| public String | Returns: a generic signature of this method with type variables substituted, nevernulla substitution function from type variable identifiers to types typeVariableSubstitution)Implements org. |
| public final boolean | Returns: true if the annotation is present, false otherwisename of the annotation type to look for, must not be name)nullImplements org. |
| public boolean | Returns: true if the annotation is present, false otherwisename of the annotation type to look for, must not be name)nullImplements org. |
| public int | |
| public boolean | |
| public boolean | |
| public boolean | Returns: true if this method is a default interface method, false otherwiseA default method is a public non-abstract non-static method declared in an interface. |
| public boolean | |
| public boolean | |
| public final AnnotationTarget. | kind()
Implements org. |
| pack-priv final MethodInternal | |
| public final String | |
| public final String | Returns: the name of the given parameter, ornull if not knownthe parameter index, zero-based i)Returns the name of the given parameter. |
| public final List | Returns: immutable list of parameter types of this method, nevernullReturns a list of parameters declared on this method, in declaration order. |
| public final int | Returns: the number of parameters this method declaresReturns the number of parameters this method declares. |
| public final Type | Returns: the type of the given parameterthe parameter index, zero-based i)Returns the type of the given parameter. |
| public final List | Returns: immutable list of parameter types of this method, nevernullReturns a list of types of parameters declared on this method, in declaration order. |
| public final Type | Returns: the receiver type of this methodReturns the receiver type of this method (a declaration of the "this" reference), if specified. |
| public boolean | Returns: whether this method must have a generic signatureImplements org. |
| public final Type | Returns: the type of this method's return valueReturns this method's return parameter type. |
| pack-priv void | |
| pack-priv final void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv final void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public String | Returns: a string representation of this methodOverrides java. |
| pack-priv final Type[] | |
| public final List | Returns: immutable list of generic type parameters for this method, or an empty list if noneReturns the generic type parameters defined by this method. |
| clazz | back to summary |
|---|---|
| private ClassInfo clazz | |
| EMPTY_PARAMETER_NAMES | back to summary |
|---|---|
| pack-priv static final String[] EMPTY_PARAMETER_NAMES | |
| methodInternal | back to summary |
|---|---|
| private MethodInternal methodInternal | |
| MethodInfo | back to summary |
|---|---|
| pack-priv MethodInfo() | |
| MethodInfo | back to summary |
|---|---|
| pack-priv MethodInfo(ClassInfo clazz, MethodInternal methodInternal) | |
| MethodInfo | back to summary |
|---|---|
| pack-priv MethodInfo(ClassInfo clazz, byte[] name, byte[][] parameterNames, Type[] parameterTypes, Type returnType, short flags) | |
| MethodInfo | back to summary |
|---|---|
| pack-priv MethodInfo(ClassInfo clazz, byte[] name, byte[][] parameterNames, Type[] parameterTypes, Type returnType, short flags, Type[] typeParameters, Type[] exceptions) | |
| annotation | back to summary |
|---|---|
| public final AnnotationInstance annotation(DotName name) Implements org. Returns the annotation instance with given name declared on this method, any of its parameters or any type
within its signature. The The following is a non-exhaustive list of examples of annotations returned by this method:
@MyMethodAnnotation
public void foo() {...}
public void foo(@MyParamAnnotation int param) {...}
public void foo(List<@MyTypeAnnotation String> list) {...}
public <@MyTypeAnnotation T> void foo(T t) {...}
In case an annotation with given name occurs more than once, the result of this method is not deterministic.
For such situations,
| |
| annotations | back to summary |
|---|---|
| public final List Implements org. Returns the annotation instances with given name declared on this method, any of its parameters or any type
within its signature. The The following is a non-exhaustive list of examples of annotations returned by this method:
@MyMethodAnnotation
public void foo() {...}
public void foo(@MyParamAnnotation int param) {...}
public void foo(List<@MyTypeAnnotation String> list) {...}
public <@MyTypeAnnotation T> void foo(T t) {...}
| |
| annotations | back to summary |
|---|---|
| public final List Implements org. Returns the annotation instances declared on this method, any of its parameters or any type
within its signature. The The following is a non-exhaustive list of examples of annotations returned by this method:
@MyMethodAnnotation
public void foo() {...}
public void foo(@MyParamAnnotation int param) {...}
public void foo(List<@MyTypeAnnotation String> list) {...}
public <@AnotherTypeAnnotation T> void foo(T t) {...}
| |
| annotationsWithRepeatable | back to summary |
|---|---|
| public final List Implements org. Returns the annotation instances with given name declared on this method, any of its parameters or any type
within its signature. The
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the
| |
| args | back to summary |
|---|---|
| public final Type[] args()
Deprecated use Returns an array of parameter types in declaration order. Jandex makes reasonable attempts to not include implicitly declared (aka mandated) and synthetic parameters.
This method performs a defensive array copy per call, and should be avoided.
Instead, the
| |
| asClass | back to summary |
|---|---|
| public final ClassInfo asClass() Implements org. Doc from org. Casts and returns this target as a | |
| asField | back to summary |
|---|---|
| public final FieldInfo asField() Implements org. Doc from org. Casts and returns this target as a | |
| asMethod | back to summary |
|---|---|
| public final MethodInfo asMethod() Implements org. Doc from org. Casts and returns this target as a
| |
| asMethodParameter | back to summary |
|---|---|
| public final MethodParameterInfo asMethodParameter() Implements org. Doc from org. Casts and returns this target as a
| |
| asRecordComponent | back to summary |
|---|---|
| public final RecordComponentInfo asRecordComponent() Implements org. Doc from org. Casts and returns this target as a
| |
| asType | back to summary |
|---|---|
| public final TypeTarget asType() Implements org. Doc from org. Casts and returns this target as a
| |
| copyExceptions | back to summary |
|---|---|
| pack-priv final Type[] copyExceptions() | |
| copyParameters | back to summary |
|---|---|
| pack-priv final Type[] copyParameters() | |
| create | back to summary |
|---|---|
| public static MethodInfo create(ClassInfo clazz, String name, Type[] parameterTypes, Type returnType, short flags) Construct a new mock Method instance.
| |
| create | back to summary |
|---|---|
| public static MethodInfo create(ClassInfo clazz, String name, Type[] parameterTypes, Type returnType, short flags, TypeVariable[] typeParameters, Type[] exceptions) Construct a new mock Method instance.
| |
| create | back to summary |
|---|---|
| public static MethodInfo create(ClassInfo clazz, String name, String[] parameterNames, Type[] parameterTypes, Type returnType, short flags, TypeVariable[] typeParameters, Type[] exceptions) Construct a new mock Method instance.
| |
| declaredAnnotation | back to summary |
|---|---|
| public AnnotationInstance declaredAnnotation(DotName name) Implements org. Returns the annotation instance with given name declared on this method.
Unlike
| |
| declaredAnnotations | back to summary |
|---|---|
| public List Implements org. Returns the annotation instances declared on this method.
Unlike
| |
| declaredAnnotationsWithRepeatable | back to summary |
|---|---|
| public List Implements org. Returns the annotation instances with given name declared on this method.
If the specified annotation is repeatable, the result also contains all values from the container annotation
instance. In this case, the
Unlike
| |
| declaringClass | back to summary |
|---|---|
| public final ClassInfo declaringClass() Returns the class that declared this method
| |
| defaultValue | back to summary |
|---|---|
| public AnnotationValue defaultValue() Returns the default annotation value if this method represents an annotation member with a default value. Otherwise null is returned
| |
| descriptor | back to summary |
|---|---|
| public String descriptor(Function<String, Type> typeVariableSubstitution) Implements org. Returns a bytecode descriptor of this method.
Descriptors of type variables are substituted for descriptors of types provided by the substitution
function Note that the return value does not come directly from bytecode. Jandex does not store the descriptor strings. Instead, the return value is reconstructed from the Jandex object model.
| |
| descriptorParametersCount | back to summary |
|---|---|
| public final int descriptorParametersCount() Returns the number of all parameters present on this method, based on the method descriptor. This always includes implicitly declared (aka mandated) and synthetic parameters.
| |
| descriptorParameterTypes | back to summary |
|---|---|
| public final List Returns a list of types of all parameters present on this method, based on the method descriptor.
This always includes implicitly declared (aka mandated) and synthetic parameters. These types are
never annotated and their position in the list cannot be used to retrieve a name using
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
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. | |
| exceptions | back to summary |
|---|---|
| public final List Returns the list of throwable classes declared to be thrown by this method. This method may return an empty list, but never null. | |
| flags | back to summary |
|---|---|
| public final short flags() Returns the access fields of this method.
| |
| genericSignature | back to summary |
|---|---|
| public String genericSignature(Function<String, Type> typeVariableSubstitution) Implements org. Returns a generic signature of this method, possibly without any generic-related information. That is, produces a correct generic signature even if this method is not generic and does not use any type variables.
Signatures of type variables are substituted for signatures of types provided by the substitution
function Note that the return value does not come directly from bytecode. Jandex does not store the signature strings. Instead, the return value is reconstructed from the Jandex object model. | |
| hasAnnotation | back to summary |
|---|---|
| public final boolean hasAnnotation(DotName name) Implements org. Returns whether an annotation instance with given name is declared on this method, its parameters or any type within its signature.
| |
| hasDeclaredAnnotation | back to summary |
|---|---|
| public boolean hasDeclaredAnnotation(DotName name) Implements org. Returns whether an annotation instance with given name is declared on this method.
Unlike
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isBridge | back to summary |
|---|---|
public boolean isBridge()
| |
| isConstructor | back to summary |
|---|---|
public boolean isConstructor()
| |
| isDefault | back to summary |
|---|---|
| public boolean isDefault() A default method is a public non-abstract non-static method declared in an interface.
| |
| isStaticInitializer | back to summary |
|---|---|
public boolean isStaticInitializer()
| |
| isSynthetic | back to summary |
|---|---|
public boolean isSynthetic()
| |
| kind | back to summary |
|---|---|
| public final AnnotationTarget. Implements org. Doc from org. Returns the kind of object this target represents.
| |
| methodInternal | back to summary |
|---|---|
| pack-priv final MethodInternal methodInternal() | |
| name | back to summary |
|---|---|
| public final String name() Returns the name of this method
| |
| parameterName | back to summary |
|---|---|
| public final String parameterName(int i) Returns the name of the given parameter.
| |
| parameters | back to summary |
|---|---|
| public final List Returns a list of parameters declared on this method, in declaration order. Jandex makes reasonable attempts to not include implicitly declared (aka mandated) and synthetic parameters.
| |
| parametersCount | back to summary |
|---|---|
| public final int parametersCount() Returns the number of parameters this method declares. Jandex makes reasonable attempts to not count implicitly declared (aka mandated) and synthetic parameters.
| |
| parameterType | back to summary |
|---|---|
| public final Type parameterType(int i) Returns the type of the given parameter.
| |
| parameterTypes | back to summary |
|---|---|
| public final List Returns a list of types of parameters declared on this method, in declaration order.
Jandex makes reasonable attempts to not include implicitly declared (aka mandated) and synthetic parameters.
Positions of types in this list may be used to retrieve a name using | |
| receiverType | back to summary |
|---|---|
| public final Type receiverType() Returns the receiver type of this method (a declaration of the "this" reference), if specified. This is used to convey annotations on the "this" instance.
| |
| requiresGenericSignature | back to summary |
|---|---|
| public boolean requiresGenericSignature() Implements org. Returns whether this method must have a generic signature. That is, whether the Java compiler
when compiling this method had to emit the
| |
| returnType | back to summary |
|---|---|
| public final Type returnType() Returns this method's return parameter type. If this method has a void return, a special void type is returned. This method will never return null.
| |
| setAnnotations | back to summary |
|---|---|
| pack-priv void setAnnotations(List<AnnotationInstance> annotations) | |
| setClassInfo | back to summary |
|---|---|
| pack-priv final void setClassInfo(ClassInfo clazz) | |
| setDefaultValue | back to summary |
|---|---|
| pack-priv void setDefaultValue(AnnotationValue defaultValue) | |
| setExceptions | back to summary |
|---|---|
| pack-priv void setExceptions(Type[] exceptions) | |
| setMethodInternal | back to summary |
|---|---|
| pack-priv final void setMethodInternal(MethodInternal methodInternal) | |
| setParameters | back to summary |
|---|---|
| pack-priv void setParameters(Type[] parameters) | |
| setReceiverType | back to summary |
|---|---|
| pack-priv void setReceiverType(Type receiverType) | |
| setReturnType | back to summary |
|---|---|
| pack-priv void setReturnType(Type returnType) | |
| setTypeParameters | back to summary |
|---|---|
| pack-priv void setTypeParameters(Type[] typeParameters) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string representation describing this method. It is similar although not necessarily identical to a Java source code declaration of this method.
| |
| typeParameterArray | back to summary |
|---|---|
| pack-priv final Type[] typeParameterArray() | |
| typeParameters | back to summary |
|---|---|
| public final List Returns the generic type parameters defined by this method. This list will contain resolved type variables which may reference other type parameters, including those declared by the enclosing class of this method.
| |