Top Description Fields Constructors Methods
io.github.classgraph

public Class MethodParameterInfo

extends Object
Class Inheritance
Imports
java.lang.annotation.Annotation, .Repeatable, java.lang.reflect.Modifier, java.util.Arrays, .Collections, .Objects, nonapi.io.github.classgraph.utils.Assert

Information on the parameters of a method.
Author
lukehutch

Field Summary

Modifier and TypeField and Description
pack-priv final AnnotationInfo[]
annotationInfo

The annotation info.

private final MethodInfo
methodInfo

The containing method.

private final int
modifiers

The modifiers.

private final String
name

The parameter name.

private ScanResult
scanResult

The scan result.

private final TypeSignature
typeDescriptor

The type descriptor.

private final TypeSignature
typeSignature

The type signature.

Constructor Summary

AccessConstructor and Description
pack-priv
MethodParameterInfo(final MethodInfo
The MethodInfo for the defining method.
methodInfo
,
final AnnotationInfo[]
AnnotationInfo for any annotations on this method parameter.
annotationInfo
,
final int
The method parameter modifiers.
modifiers
,
final TypeSignature
The method parameter type descriptor.
typeDescriptor
,
final TypeSignature
The method parameter type signature.
typeSignature
,
final String
The method parameter name.
name
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

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

public AnnotationInfoList

Returns:

AnnotationInfo for any annotations on this method parameter.
getAnnotationInfo
()

Method parameter annotation info (or null if no annotations).

public AnnotationInfo

Returns:

An AnnotationInfo object representing the annotation on this method parameter, or null if the method parameter does not have the annotation.
getAnnotationInfo
(final Class<? extends Annotation>
The annotation.
annotation
)

Get a the non-Repeatable annotation on this method, or null if the method parameter does not have the annotation.

public AnnotationInfo

Returns:

An AnnotationInfo object representing the named annotation on this method parameter, or null if the method parameter does not have the named annotation.
getAnnotationInfo
(final String
The annotation name.
annotationName
)

Get a the named non-Repeatable annotation on this method, or null if the method parameter does not have the named annotation.

public AnnotationInfoList

Returns:

An AnnotationInfoList containing all instances of the annotation on this method parameter, or the empty list if the method parameter does not have the annotation.
getAnnotationInfoRepeatable
(final Class<? extends Annotation>
The annotation.
annotation
)

Get a the Repeatable annotation on this method, or the empty list if the method parameter does not have the annotation.

public AnnotationInfoList

Returns:

An AnnotationInfoList containing all instances of the named annotation on this method parameter, or the empty list if the method parameter does not have the named annotation.
getAnnotationInfoRepeatable
(final String
The annotation name.
annotationName
)

Get a the named Repeatable annotation on this method, or the empty list if the method parameter does not have the named annotation.

public MethodInfo

Returns:

The MethodInfo for the defining method.
getMethodInfo
()

Get the MethodInfo for the defining method.

public int

Returns:

The method parameter modifiers.
getModifiers
()

Method parameter modifiers.

public String

Returns:

The modifiers for the method parameter, as a String.
getModifiersStr
()

Get the method parameter modifiers as a String, e.g. "final".

public String

Returns:

The method parameter name.
getName
()

Method parameter name.

public TypeSignature

Returns:

The method type descriptor.
getTypeDescriptor
()

Method parameter type descriptor.

public TypeSignature

Returns:

The method type signature, if available, else null.
getTypeSignature
()

Method parameter type signature, possibly including generic type information (or null if no type signature information available for this parameter).

public TypeSignature

Returns:

The method type signature, if present, otherwise the method type descriptor.
getTypeSignatureOrTypeDescriptor
()

Method parameter type signature, or if not available, method type descriptor.

public boolean

Returns:

true if this method parameter has the annotation.
hasAnnotation
(final Class<? extends Annotation>
The annotation.
annotation
)

Check whether this method parameter has the annotation.

public boolean

Returns:

true if this method parameter has the named annotation.
hasAnnotation
(final String
The name of an annotation.
annotationName
)

Check whether this method parameter has the named annotation.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean

Returns:

True if this method parameter is final.
isFinal
()

Returns true if this method parameter is final.

public boolean

Returns:

True if this method parameter is mandated.
isMandated
()

Returns true if this method parameter is mandated.

public boolean

Returns:

True if this method parameter is synthetic.
isSynthetic
()

Returns true if this method parameter is synthetic.

pack-priv static void
modifiersToString(final int
The field or method modifiers.
modifiers
,
final StringBuilder
The buffer to write the result into.
buf
)

Convert modifiers into a string representation, e.g. "public static final".

protected void
setScanResult(final ScanResult
the new scan result
scanResult
)

Sets the scan result.

protected void
toString(final boolean
if true, use just the simple name of each class.
useSimpleNames
,
final StringBuilder
the buf
buf
)

Render to string.

public String

Returns:

the string representation.
toString
()

Overrides java.lang.Object.toString.

Render to string.

public String

Returns:

the string representation.
toStringWithSimpleNames
()

Render to string with simple names for classes.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

annotationInfoback to summary
pack-priv final AnnotationInfo[] annotationInfo

The annotation info.

methodInfoback to summary
private final MethodInfo methodInfo

The containing method.

modifiersback to summary
private final int modifiers

The modifiers.

nameback to summary
private final String name

The parameter name.

scanResultback to summary
private ScanResult scanResult

The scan result.

typeDescriptorback to summary
private final TypeSignature typeDescriptor

The type descriptor.

typeSignatureback to summary
private final TypeSignature typeSignature

The type signature.

Constructor Detail

MethodParameterInfoback to summary
pack-priv MethodParameterInfo(final MethodInfo methodInfo, final AnnotationInfo[] annotationInfo, final int modifiers, final TypeSignature typeDescriptor, final TypeSignature typeSignature, final String name)

Constructor.

Parameters
methodInfo:MethodInfo

The MethodInfo for the defining method.

annotationInfo:AnnotationInfo[]

AnnotationInfo for any annotations on this method parameter.

modifiers:int

The method parameter modifiers.

typeDescriptor:TypeSignature

The method parameter type descriptor.

typeSignature:TypeSignature

The method parameter type signature.

name:String

The method parameter name.

Method Detail

equalsback to summary
public boolean equals(final Object obj)

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
obj: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
getAnnotationInfoback to summary
public AnnotationInfoList getAnnotationInfo()

Method parameter annotation info (or null if no annotations).

Returns:AnnotationInfoList

AnnotationInfo for any annotations on this method parameter.

getAnnotationInfoback to summary
public AnnotationInfo getAnnotationInfo(final Class<? extends Annotation> annotation)

Get a the non-Repeatable annotation on this method, or null if the method parameter does not have the annotation. (Use getAnnotationInfoRepeatable(Class) for Repeatable annotations.)

Parameters
annotation:Class<? extends Annotation>

The annotation.

Returns:AnnotationInfo

An AnnotationInfo object representing the annotation on this method parameter, or null if the method parameter does not have the annotation.

getAnnotationInfoback to summary
public AnnotationInfo getAnnotationInfo(final String annotationName)

Get a the named non-Repeatable annotation on this method, or null if the method parameter does not have the named annotation. (Use getAnnotationInfoRepeatable(String) for Repeatable annotations.)

Parameters
annotationName:String

The annotation name.

Returns:AnnotationInfo

An AnnotationInfo object representing the named annotation on this method parameter, or null if the method parameter does not have the named annotation.

getAnnotationInfoRepeatableback to summary
public AnnotationInfoList getAnnotationInfoRepeatable(final Class<? extends Annotation> annotation)

Get a the Repeatable annotation on this method, or the empty list if the method parameter does not have the annotation.

Parameters
annotation:Class<? extends Annotation>

The annotation.

Returns:AnnotationInfoList

An AnnotationInfoList containing all instances of the annotation on this method parameter, or the empty list if the method parameter does not have the annotation.

getAnnotationInfoRepeatableback to summary
public AnnotationInfoList getAnnotationInfoRepeatable(final String annotationName)

Get a the named Repeatable annotation on this method, or the empty list if the method parameter does not have the named annotation.

Parameters
annotationName:String

The annotation name.

Returns:AnnotationInfoList

An AnnotationInfoList containing all instances of the named annotation on this method parameter, or the empty list if the method parameter does not have the named annotation.

getMethodInfoback to summary
public MethodInfo getMethodInfo()

Get the MethodInfo for the defining method.

Returns:MethodInfo

The MethodInfo for the defining method.

getModifiersback to summary
public int getModifiers()

Method parameter modifiers. May be zero, if no modifier bits set, or if compiled for JDK version lower than 8, or if compiled for JDK version 8+ but without the commandline switch `-parameters`.

Returns:int

The method parameter modifiers.

getModifiersStrback to summary
public String getModifiersStr()

Get the method parameter modifiers as a String, e.g. "final". For the modifier bits, call getModifiers().

Returns:String

The modifiers for the method parameter, as a String.

getNameback to summary
public String getName()

Method parameter name. May be null, for unnamed parameters (e.g. synthetic parameters), or if compiled for JDK version lower than 8, or if compiled for JDK version 8+ but without the commandline switch `-parameters`.

Returns:String

The method parameter name.

getTypeDescriptorback to summary
public TypeSignature getTypeDescriptor()

Method parameter type descriptor.

Returns:TypeSignature

The method type descriptor.

getTypeSignatureback to summary
public TypeSignature getTypeSignature()

Method parameter type signature, possibly including generic type information (or null if no type signature information available for this parameter).

Returns:TypeSignature

The method type signature, if available, else null.

getTypeSignatureOrTypeDescriptorback to summary
public TypeSignature getTypeSignatureOrTypeDescriptor()

Method parameter type signature, or if not available, method type descriptor.

Returns:TypeSignature

The method type signature, if present, otherwise the method type descriptor.

hasAnnotationback to summary
public boolean hasAnnotation(final Class<? extends Annotation> annotation)

Check whether this method parameter has the annotation.

Parameters
annotation:Class<? extends Annotation>

The annotation.

Returns:boolean

true if this method parameter has the annotation.

hasAnnotationback to summary
public boolean hasAnnotation(final String annotationName)

Check whether this method parameter has the named annotation.

Parameters
annotationName:String

The name of an annotation.

Returns:boolean

true if this method parameter has the named annotation.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this 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
isFinalback to summary
public boolean isFinal()

Returns true if this method parameter is final.

Returns:boolean

True if this method parameter is final.

isMandatedback to summary
public boolean isMandated()

Returns true if this method parameter is mandated.

Returns:boolean

True if this method parameter is mandated.

isSyntheticback to summary
public boolean isSynthetic()

Returns true if this method parameter is synthetic.

Returns:boolean

True if this method parameter is synthetic.

modifiersToStringback to summary
pack-priv static void modifiersToString(final int modifiers, final StringBuilder buf)

Convert modifiers into a string representation, e.g. "public static final".

Parameters
modifiers:int

The field or method modifiers.

buf:StringBuilder

The buffer to write the result into.

setScanResultback to summary
protected void setScanResult(final ScanResult scanResult)

Sets the scan result.

Parameters
scanResult:ScanResult

the new scan result

toStringback to summary
protected void toString(final boolean useSimpleNames, final StringBuilder buf)

Render to string.

Parameters
useSimpleNames:boolean

if true, use just the simple name of each class.

buf:StringBuilder

the buf

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Render to string.

Returns:String

the string representation.

Annotations
@Override
toStringWithSimpleNamesback to summary
public String toStringWithSimpleNames()

Render to string with simple names for classes.

Returns:String

the string representation.