public class MethodInfo extends MemberInfo implements AccessFlags
method_info" structure as defined in
the JVM specification.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CODE |
static java.lang.String |
EXCEPTIONS |
cf, DEPRECATED, RUNTIME_VISIBLE_ANNOTATIONS, SIGNATUREACC_ABSTRACT, ACC_ANNOTATION, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VOLATILE| Constructor and Description |
|---|
MethodInfo(ClassFile cf,
int accessFlags,
int nameIndex,
int descriptorIndex)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
AttributeInfo |
getAttribute(int index)
Returns the specified attribute.
|
int |
getAttributeCount()
Returns the number of attributes of this field.
|
java.lang.String |
getDescriptor()
Returns the descriptor of this member.
|
java.lang.String |
getName()
Returns the name of this member.
|
java.lang.String |
getNameAndParameters()
Returns the name and parameters of this method, in the form
performAction(String, int, Runnable). |
int |
getParameterCount()
Returns the number of parameters this method takes.
|
java.lang.String |
getParameterName(int index)
If debugging was enabled during compilation, this method returns the
name of the given parameter to this method.
|
java.lang.String |
getParameterType(int index,
boolean fullyQualified)
Returns a string representing the type of a parameter to this method.
|
java.lang.String[] |
getParameterTypes()
Returns an array if strings representing the types of all parameters
to this method.
|
java.lang.String |
getReturnTypeString(boolean fullyQualified)
Returns the return type of this method.
|
java.lang.String |
getSignature()
Returns the signature of this method, as determined from its method
descriptor.
|
boolean |
isAbstract()
Returns whether this method is abstract.
|
boolean |
isConstructor()
Returns whether this method is a constructor.
|
boolean |
isNative()
Returns whether this method is native.
|
boolean |
isStatic()
Returns whether this method is static.
|
static MethodInfo |
read(ClassFile cf,
java.io.DataInputStream in)
Reads a
MethodInfo from an input stream. |
getAccessFlags, getClassFile, isDeprecated, isFinal, readAttributepublic static final java.lang.String CODE
public static final java.lang.String EXCEPTIONS
public MethodInfo(ClassFile cf, int accessFlags, int nameIndex, int descriptorIndex)
cf - The class file defining this method.public AttributeInfo getAttribute(int index)
index - The index of the attribute.public int getAttributeCount()
public java.lang.String getDescriptor()
getDescriptor in class MemberInfopublic java.lang.String getName()
getName in class MemberInfopublic java.lang.String getNameAndParameters()
performAction(String, int, Runnable).public int getParameterCount()
getParameterTypes(),
getParameterType(int, boolean)public java.lang.String getParameterName(int index)
null
is returned.index - The index of the parameter.null.public java.lang.String getParameterType(int index,
boolean fullyQualified)
index - The index of the parameter.fullyQualified - Whether the returned type should be fully
qualified. Note that if fully qualified information is not
available for the parameters to this method, this parameter will
be ignored (but I'm not sure that ever happens).getParameterCount(),
getParameterTypes()public java.lang.String[] getParameterTypes()
getParameterCount(),
getParameterType(int, boolean)public java.lang.String getReturnTypeString(boolean fullyQualified)
public java.lang.String getSignature()
public boolean isAbstract()
public boolean isConstructor()
public boolean isNative()
public boolean isStatic()
isStatic in class MemberInfopublic static MethodInfo read(ClassFile cf, java.io.DataInputStream in) throws java.io.IOException
MethodInfo from an input stream.cf - The class file defining the method.in - The input stream to read from.java.io.IOException - If an IO error occurs.