Package io.github.classgraph
Class MethodParameterInfo
java.lang.Object
io.github.classgraph.MethodParameterInfo
Information on the parameters of a method.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final AnnotationInfo[]
The annotation info.private final MethodInfo
The containing method.private final int
The modifiers.private final String
The parameter name.private ScanResult
The scan result.private final TypeSignature
The type descriptor.private final TypeSignature
The type signature. -
Constructor Summary
ConstructorsConstructorDescriptionMethodParameterInfo
(MethodInfo methodInfo, AnnotationInfo[] annotationInfo, int modifiers, TypeSignature typeDescriptor, TypeSignature typeSignature, String name) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Method parameter annotation info (or null if no annotations).getAnnotationInfo
(Class<? extends Annotation> annotation) Get a the non-Repeatable
annotation on this method, or null if the method parameter does not have the annotation.getAnnotationInfo
(String annotationName) Get a the named non-Repeatable
annotation on this method, or null if the method parameter does not have the named annotation.getAnnotationInfoRepeatable
(Class<? extends Annotation> annotation) Get a theRepeatable
annotation on this method, or the empty list if the method parameter does not have the annotation.getAnnotationInfoRepeatable
(String annotationName) Get a the namedRepeatable
annotation on this method, or the empty list if the method parameter does not have the named annotation.Get theMethodInfo
for the defining method.int
Method parameter modifiers.Get the method parameter modifiers as a String, e.g.getName()
Method parameter name.Method parameter type descriptor.Method parameter type signature, possibly including generic type information (or null if no type signature information available for this parameter).Method parameter type signature, or if not available, method type descriptor.boolean
hasAnnotation
(Class<? extends Annotation> annotation) Check whether this method parameter has the annotation.boolean
hasAnnotation
(String annotationName) Check whether this method parameter has the named annotation.int
hashCode()
boolean
isFinal()
Returns true if this method parameter is final.boolean
Returns true if this method parameter is mandated.boolean
Returns true if this method parameter is synthetic.(package private) static void
modifiersToString
(int modifiers, StringBuilder buf) Convert modifiers into a string representation, e.g.protected void
setScanResult
(ScanResult scanResult) Sets the scan result.toString()
Render to string.protected void
toString
(boolean useSimpleNames, StringBuilder buf) Render to string.Render to string with simple names for classes.
-
Field Details
-
methodInfo
The containing method. -
annotationInfo
The annotation info. -
modifiers
private final int modifiersThe modifiers. -
typeDescriptor
The type descriptor. -
typeSignature
The type signature. -
name
The parameter name. -
scanResult
The scan result.
-
-
Constructor Details
-
MethodParameterInfo
MethodParameterInfo(MethodInfo methodInfo, AnnotationInfo[] annotationInfo, int modifiers, TypeSignature typeDescriptor, TypeSignature typeSignature, String name) Constructor.- Parameters:
methodInfo
- TheMethodInfo
for the defining method.annotationInfo
-AnnotationInfo
for any annotations on this method parameter.modifiers
- The method parameter modifiers.typeDescriptor
- The method parameter type descriptor.typeSignature
- The method parameter type signature.name
- The method parameter name.
-
-
Method Details
-
getMethodInfo
Get theMethodInfo
for the defining method.- Returns:
- The
MethodInfo
for the defining method.
-
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:
- The method parameter name.
-
getModifiers
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:
- The method parameter modifiers.
-
getModifiersStr
Get the method parameter modifiers as a String, e.g. "final". For the modifier bits, callgetModifiers()
.- Returns:
- The modifiers for the method parameter, as a String.
-
getTypeSignature
Method parameter type signature, possibly including generic type information (or null if no type signature information available for this parameter).- Returns:
- The method type signature, if available, else null.
-
getTypeDescriptor
Method parameter type descriptor.- Returns:
- The method type descriptor.
-
getTypeSignatureOrTypeDescriptor
Method parameter type signature, or if not available, method type descriptor.- Returns:
- The method type signature, if present, otherwise the method type descriptor.
-
getAnnotationInfo
Method parameter annotation info (or null if no annotations).- Returns:
AnnotationInfo
for any annotations on this method parameter.
-
getAnnotationInfo
Get a the non-Repeatable
annotation on this method, or null if the method parameter does not have the annotation. (UsegetAnnotationInfoRepeatable(Class)
forRepeatable
annotations.)- Parameters:
annotation
- The annotation.- Returns:
- An
AnnotationInfo
object representing the annotation on this method parameter, or null if the method parameter does not have the annotation.
-
getAnnotationInfo
Get a the named non-Repeatable
annotation on this method, or null if the method parameter does not have the named annotation. (UsegetAnnotationInfoRepeatable(String)
forRepeatable
annotations.)- Parameters:
annotationName
- The annotation name.- Returns:
- An
AnnotationInfo
object representing the named annotation on this method parameter, or null if the method parameter does not have the named annotation.
-
getAnnotationInfoRepeatable
Get a theRepeatable
annotation on this method, or the empty list if the method parameter does not have the annotation.- Parameters:
annotation
- The annotation.- 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
Get a the namedRepeatable
annotation on this method, or the empty list if the method parameter does not have the named annotation.- Parameters:
annotationName
- The annotation name.- 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.
-
hasAnnotation
Check whether this method parameter has the annotation.- Parameters:
annotation
- The annotation.- Returns:
- true if this method parameter has the annotation.
-
hasAnnotation
Check whether this method parameter has the named annotation.- Parameters:
annotationName
- The name of an annotation.- Returns:
- true if this method parameter has the named annotation.
-
setScanResult
Sets the scan result.- Parameters:
scanResult
- the new scan result
-
isFinal
public boolean isFinal()Returns true if this method parameter is final.- Returns:
- True if this method parameter is final.
-
isSynthetic
public boolean isSynthetic()Returns true if this method parameter is synthetic.- Returns:
- True if this method parameter is synthetic.
-
isMandated
public boolean isMandated()Returns true if this method parameter is mandated.- Returns:
- True if this method parameter is mandated.
-
equals
-
hashCode
public int hashCode() -
modifiersToString
Convert modifiers into a string representation, e.g. "public static final".- Parameters:
modifiers
- The field or method modifiers.buf
- The buffer to write the result into.
-
toString
Render to string.- Parameters:
useSimpleNames
- if true, use just the simple name of each class.buf
- the buf
-
toStringWithSimpleNames
Render to string with simple names for classes.- Returns:
- the string representation.
-
toString
Render to string.
-