All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class espresso.classfile.javaclass.Method

java.lang.Object
   |
   +----espresso.classfile.javaclass.Method

public final class Method
extends Object
implements Constants
This class represents the method info structure, i.e. the representation for a method in the class. See JVM specification for details. A method has access flags, a name, a signature and a number of attributes.


Variable Index

 o access_flags
 o attributes
 o attributes_count
 o constant_pool
 o name_index
 o signature_index

Constructor Index

 o Method()
Empty constructor, all attributes have to be defined via `setXXX' methods.
 o Method(DataInputStream, ConstantPool)
Construct object from file stream.
 o Method(int, int, int, Attribute[], ConstantPool)
 o Method(Method)
Initialize from another object.

Method Index

 o accept(Visitor)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class.
 o dump(DataOutputStream)
Dump method to file stream on binary format.
 o getAccessFlags()
 o getAttributes()
 o getCode()
 o getConstantPool()
 o getName()
 o getNameIndex()
 o getSignature()
 o getSignatureIndex()
 o setAccessFlags(int)
 o setAttributes(Attribute[])
 o setConstantPool(ConstantPool)
 o setNameIndex(int)
 o setSignatureIndex(int)
 o toString()
Return string representation close to declaration format, `public static int main(String[]) throws IOException', e.g.

Variables

 o access_flags
 private int access_flags
 o name_index
 private int name_index
 o signature_index
 private int signature_index
 o attributes_count
 private int attributes_count
 o attributes
 private Attribute attributes[]
 o constant_pool
 private ConstantPool constant_pool

Constructors

 o Method
 public Method()
Empty constructor, all attributes have to be defined via `setXXX' methods. Use at your own risk.

 o Method
 public Method(Method c)
Initialize from another object. Note that both objects use the same references (shallow copy). Use clone() for a physical copy.

 o Method
 Method(DataInputStream file,
        ConstantPool constant_pool) throws IOException, ClassFormatError
Construct object from file stream.

Parameters:
file - Input stream
 o Method
 public Method(int access_flags,
               int name_index,
               int signature_index,
               Attribute attributes[],
               ConstantPool constant_pool)
Parameters:
access_flags - Access rights of method
name_index - Points to field name in constant pool
signature_index - Points to encoded signature
attributes - Collection of attributes
constant_pool - Array of constants

Methods

 o accept
 public void accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.

Parameters:
v - Visitor object
 o dump
 public final void dump(DataOutputStream file) throws IOException
Dump method to file stream on binary format.

Parameters:
file - Output file stream
 o getAccessFlags
 public final int getAccessFlags()
Returns:
Access flags of the class field.
 o getAttributes
 public final Attribute[] getAttributes()
Returns:
Collection of method attributes.
 o getCode
 public final Code getCode()
Returns:
Code attribute of method
 o getConstantPool
 public final ConstantPool getConstantPool()
Returns:
Constant pool used by this object.
See Also:
ConstantPool
 o getName
 public final String getName()
Returns:
Name of method
 o getNameIndex
 public final int getNameIndex()
Returns:
Index in constant pool of field name.
 o getSignature
 public final String getSignature()
Returns:
String representation of method type signature.
 o getSignatureIndex
 public final int getSignatureIndex()
Returns:
Index in constant pool of field signature.
 o setAccessFlags
 public final void setAccessFlags(int access_flags)
 o setAttributes
 public final void setAttributes(Attribute attributes[])
 o setConstantPool
 public final void setConstantPool(ConstantPool constant_pool)
Parameters:
constant_pool - Constant pool to be used for this object.
See Also:
ConstantPool
 o setNameIndex
 public final void setNameIndex(int name_index)
 o setSignatureIndex
 public final void setSignatureIndex(int signature_index)
 o toString
 public final String toString()
Return string representation close to declaration format, `public static int main(String[]) throws IOException', e.g.

Returns:
String representation of the method.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index