org.fife.rsta.ac.java.classreader
Class MethodInfo

java.lang.Object
  extended by org.fife.rsta.ac.java.classreader.MemberInfo
      extended by org.fife.rsta.ac.java.classreader.MethodInfo
All Implemented Interfaces:
AccessFlags

public class MethodInfo
extends MemberInfo
implements AccessFlags

Implementation of the "method_info" structure as defined in the JVM specification.

Version:
1.0
Author:
Robert Futrell

Field Summary
static String CODE
           
static String EXCEPTIONS
           
static String SIGNATURE
           
 
Fields inherited from class org.fife.rsta.ac.java.classreader.MemberInfo
cf, DEPRECATED
 
Fields inherited from interface org.fife.rsta.ac.java.classreader.AccessFlags
ACC_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 Summary
MethodInfo(ClassFile cf, int accessFlags, int nameIndex, int descriptorIndex)
          Constructor.
 
Method Summary
 AttributeInfo getAttribute(int index)
          Returns the specified attribute.
 int getAttributeCount()
          Returns the number of attributes of this field.
 String getDescriptor()
          Returns the descriptor of this member.
 String getName()
          Returns the name of this member.
 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.
 String getParameterName(int index)
          If debugging was enabled during compilation, this method returns the name of the given parameter to this method.
 String getParameterType(int index, boolean fullyQualified)
          Returns a string representing the type of a parameter to this method.
 String[] getParameterTypes()
          Returns an array if strings representing the types of all parameters to this method.
 String getReturnTypeString()
          Returns the return type of this method.
 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, DataInputStream in)
          Reads a MethodInfo from an input stream.
 
Methods inherited from class org.fife.rsta.ac.java.classreader.MemberInfo
getAccessFlags, getClassFile, isDeprecated, isFinal, readAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CODE

public static final String CODE
See Also:
Constant Field Values

EXCEPTIONS

public static final String EXCEPTIONS
See Also:
Constant Field Values

SIGNATURE

public static final String SIGNATURE
See Also:
Constant Field Values
Constructor Detail

MethodInfo

public MethodInfo(ClassFile cf,
                  int accessFlags,
                  int nameIndex,
                  int descriptorIndex)
Constructor.

Parameters:
cf - The class file defining this method.
Method Detail

getAttribute

public AttributeInfo getAttribute(int index)
Returns the specified attribute.

Parameters:
index - The index of the attribute.
Returns:
The attribute.

getAttributeCount

public int getAttributeCount()
Returns the number of attributes of this field.

Returns:
The number of attributes.

getDescriptor

public String getDescriptor()
Returns the descriptor of this member.

Specified by:
getDescriptor in class MemberInfo
Returns:
The descriptor of this member.

getName

public String getName()
Returns the name of this member.

Specified by:
getName in class MemberInfo
Returns:
The name of this member.

getNameAndParameters

public String getNameAndParameters()
Returns the name and parameters of this method, in the form performAction(String, int, Runnable).

Returns:
The name and parameters of this method.

getParameterCount

public int getParameterCount()
Returns the number of parameters this method takes.

Returns:
The number of parameters this method takes.
See Also:
getParameterTypes(), getParameterType(int, boolean)

getParameterName

public String getParameterName(int index)
If debugging was enabled during compilation, this method returns the name of the given parameter to this method. Otherwise, null is returned.

Parameters:
index - The index of the parameter.
Returns:
The name of the parameter, or null.

getParameterType

public String getParameterType(int index,
                               boolean fullyQualified)
Returns a string representing the type of a parameter to this method.

Parameters:
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).
Returns:
The type of the parameter.
See Also:
getParameterCount(), getParameterTypes()

getParameterTypes

public String[] getParameterTypes()
Returns an array if strings representing the types of all parameters to this method. If this method takes no parameters, a zero-length array is returned.

Returns:
The array. These types will likely be fully qualified.
See Also:
getParameterCount(), getParameterType(int, boolean)

getReturnTypeString

public String getReturnTypeString()
Returns the return type of this method.

Returns:
The return type of this method.

getSignature

public String getSignature()
Returns the signature of this method, as determined from its method descriptor.

Returns:
The signature of this method.

isAbstract

public boolean isAbstract()
Returns whether this method is abstract.

Returns:
Whether this method is abstract.

isConstructor

public boolean isConstructor()
Returns whether this method is a constructor.

Returns:
Whether this method is a constructor.

isNative

public boolean isNative()
Returns whether this method is native.

Returns:
Whether this method is native.

isStatic

public boolean isStatic()
Returns whether this method is static.

Overrides:
isStatic in class MemberInfo
Returns:
Whether this method is static.

read

public static MethodInfo read(ClassFile cf,
                              DataInputStream in)
                       throws IOException
Reads a MethodInfo from an input stream.

Parameters:
cf - The class file defining the method.
in - The input stream to read from.
Returns:
The method information read.
Throws:
IOException - If an IO error occurs.


Copyright © 2003-2011. All Rights Reserved.