com.go.trove.classfile
Class MethodInfo

java.lang.Object
  |
  +--com.go.trove.classfile.MethodInfo

public class MethodInfo
extends java.lang.Object

This class corresponds to the method_info data structure as defined in section 4.6 of The Java Virtual Machine Specification. To make it easier to create bytecode for a method's CodeAttr, the CodeBuilder class is provided.

Version:
31 , 00/11/27
Author:
Brian S O'Neill
See Also:
ClassFile, CodeBuilder

Method Summary
 void addAttribute(Attribute attr)
           
 void addException(java.lang.String className)
          Add a declared exception that this method may throw.
 AccessFlags getAccessFlags()
          Returns a copy of this method's access flags.
 Attribute[] getAttributes()
           
 ClassFile getClassFile()
          Returns the parent ClassFile for this MethodInfo.
 CodeAttr getCodeAttr()
          Returns a CodeAttr object used to manipulate the method code body, or null if this method is abstract.
 ConstantUTFInfo getDescriptorConstant()
          Returns a constant from the constant pool with this method's type descriptor string.
 java.lang.String[] getExceptions()
          Returns the exceptions that this method is declared to throw.
 int getLength()
          Returns the length (in bytes) of this object in the class file.
 MethodDescriptor getMethodDescriptor()
          Returns a MethodDescriptor which describes return and parameter types of this method.
 java.lang.String getName()
          Returns the name of this method.
 ConstantUTFInfo getNameConstant()
          Returns a constant from the constant pool with this method's name.
 boolean isDeprecated()
           
 boolean isSynthetic()
           
 void markDeprecated()
          Mark this method as being deprecated by adding a special attribute.
 void markSynthetic()
          Mark this method as being synthetic by adding a special attribute.
 java.lang.String toString()
           
 void writeTo(java.io.DataOutput dout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getClassFile

public ClassFile getClassFile()
Returns the parent ClassFile for this MethodInfo.

getName

public java.lang.String getName()
Returns the name of this method.

getMethodDescriptor

public MethodDescriptor getMethodDescriptor()
Returns a MethodDescriptor which describes return and parameter types of this method.

getAccessFlags

public AccessFlags getAccessFlags()
Returns a copy of this method's access flags.

getNameConstant

public ConstantUTFInfo getNameConstant()
Returns a constant from the constant pool with this method's name.

getDescriptorConstant

public ConstantUTFInfo getDescriptorConstant()
Returns a constant from the constant pool with this method's type descriptor string.
See Also:
TypeDescriptor

getExceptions

public java.lang.String[] getExceptions()
Returns the exceptions that this method is declared to throw.

getCodeAttr

public CodeAttr getCodeAttr()
Returns a CodeAttr object used to manipulate the method code body, or null if this method is abstract.

isSynthetic

public boolean isSynthetic()

isDeprecated

public boolean isDeprecated()

addException

public void addException(java.lang.String className)
Add a declared exception that this method may throw.

markSynthetic

public void markSynthetic()
Mark this method as being synthetic by adding a special attribute.

markDeprecated

public void markDeprecated()
Mark this method as being deprecated by adding a special attribute.

addAttribute

public void addAttribute(Attribute attr)

getAttributes

public Attribute[] getAttributes()

getLength

public int getLength()
Returns the length (in bytes) of this object in the class file.

writeTo

public void writeTo(java.io.DataOutput dout)
             throws java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object