public class MethodInfo extends ClassMemberInfo implements Comparable<MethodInfo>
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(MethodInfo other)
Sort in order of class name, method name, then type descriptor.
|
boolean |
equals(Object obj)
Test class name, method name and type descriptor for equals().
|
int |
getMaxLineNum()
The line number of the last non-empty line in the body of this method, or 0 if unknown.
|
int |
getMinLineNum()
The line number of the first non-empty line in the body of this method, or 0 if unknown.
|
String |
getModifiersStr()
Get the method modifiers as a String, e.g.
|
String |
getName()
Returns the name of the method.
|
MethodParameterInfo[] |
getParameterInfo()
Get the available information on method parameters.
|
String[] |
getThrownExceptionNames()
Returns the exceptions thrown by the method, as an array.
|
ClassInfoList |
getThrownExceptions()
Returns the list of exceptions thrown by the method, as a
ClassInfoList. |
MethodTypeSignature |
getTypeDescriptor()
Returns the parsed type descriptor for the method, which will not include type parameters.
|
MethodTypeSignature |
getTypeSignature()
Returns the parsed type signature for the method, possibly including type parameters.
|
MethodTypeSignature |
getTypeSignatureOrTypeDescriptor()
Returns the parsed type signature for the method, possibly including type parameters.
|
boolean |
hasBody()
Returns true if this method has a body (i.e.
|
int |
hashCode()
Use hashcode of class name, method name and type descriptor.
|
boolean |
hasParameterAnnotation(Class<? extends Annotation> annotation)
Check if this method has a parameter with the annotation.
|
boolean |
hasParameterAnnotation(String annotationName)
Check if this method has a parameter with the named annotation.
|
boolean |
isAbstract()
Returns true if this method is abstract.
|
boolean |
isBridge()
Returns true if this method is a bridge method.
|
boolean |
isConstructor()
Returns true if this method is a constructor.
|
boolean |
isDefault()
Returns true if this is a default method (i.e.
|
boolean |
isNative()
Returns true if this method is a native method.
|
boolean |
isStrict()
Returns true if this method is strict.
|
boolean |
isSynchronized()
Returns true if this method is synchronized.
|
boolean |
isVarArgs()
Returns true if this method is a varargs method.
|
Constructor<?> |
loadClassAndGetConstructor()
Load the class this constructor is associated with, and get the
Constructor reference for this
constructor. |
Method |
loadClassAndGetMethod()
Load the class this method is associated with, and get the
Method reference for this method. |
String |
toString()
Render to string.
|
String |
toStringWithSimpleNames()
Render to string, using only simple
names for classes.
|
getAnnotationInfo, getAnnotationInfo, getAnnotationInfo, getAnnotationInfoRepeatable, getAnnotationInfoRepeatable, getClassInfo, getClassName, getModifiers, getTypeDescriptorStr, getTypeSignatureOrTypeDescriptorStr, getTypeSignatureStr, hasAnnotation, hasAnnotation, isFinal, isPrivate, isProtected, isPublic, isStatic, isSyntheticpublic String getName()
"<init>", and private static class
initializer blocks are named "<clinit>".getName in interface HasNamegetName in class ClassMemberInfopublic String getModifiersStr()
ClassMemberInfo.getModifiers().getModifiersStr in class ClassMemberInfopublic MethodTypeSignature getTypeDescriptor()
getTypeSignature() instead.getTypeDescriptor in class ClassMemberInfopublic MethodTypeSignature getTypeSignature()
getTypeDescriptor()
instead.getTypeSignature in class ClassMemberInfoIllegalArgumentException - if the method type signature cannot be parsed (this should only be thrown in the case of
classfile corruption, or a compiler bug that causes an invalid type signature to be written to
the classfile).public MethodTypeSignature getTypeSignatureOrTypeDescriptor()
getTypeSignatureOrTypeDescriptor in class ClassMemberInfopublic ClassInfoList getThrownExceptions()
ClassInfoList.ClassInfoList (the list may be empty).public String[] getThrownExceptionNames()
public boolean isConstructor()
"<init>". This returns false for private static class initializer blocks, which are named
"<clinit>".public boolean isSynchronized()
public boolean isBridge()
public boolean isVarArgs()
public boolean isNative()
public boolean isAbstract()
public boolean isStrict()
public boolean hasBody()
public int getMinLineNum()
public int getMaxLineNum()
public boolean isDefault()
public MethodParameterInfo[] getParameterInfo()
MethodParameterInfo objects for the method parameters, one per parameter.public boolean hasParameterAnnotation(Class<? extends Annotation> annotation)
annotation - The method parameter annotation.public boolean hasParameterAnnotation(String annotationName)
annotationName - The name of a method parameter annotation.public Method loadClassAndGetMethod() throws IllegalArgumentException
Method reference for this method. Only
call this if isConstructor() returns false, otherwise an IllegalArgumentException will be
thrown. Instead call loadClassAndGetConstructor() for constructors.Method reference for this method.IllegalArgumentException - if the method does not exist, or if the method is a constructor.public Constructor<?> loadClassAndGetConstructor() throws IllegalArgumentException
Constructor reference for this
constructor. Only call this if isConstructor() returns true, otherwise an
IllegalArgumentException will be thrown. Instead call loadClassAndGetMethod() for non-method
constructors.Constructor reference for this constructor.IllegalArgumentException - if the constructor does not exist, or if the method is not a constructor.public boolean equals(Object obj)
public int hashCode()
public int compareTo(MethodInfo other)
compareTo in interface Comparable<MethodInfo>other - the other MethodInfo to compare.public String toStringWithSimpleNames()
Copyright © 2024. All rights reserved.