Class DE.fub.inf.JVM.JavaClass.Method
java.lang.Object
|
+--DE.fub.inf.JVM.JavaClass.Method
- public final class Method
- extends java.lang.Object
- implements Constants, java.lang.Cloneable
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.
- Version:
- $Id: Method.java,v 1.3 1998/08/14 16:56:25 dahm Exp $
- Author:
- M. Dahm
Constructor Summary
|
Method()
Empty constructor, all attributes have to be defined via `setXXX'
methods. |
Method(Method c)
Initialize from another object. |
Method(int access_flags,
int name_index,
int signature_index,
Attribute[] attributes,
ConstantPool constant_pool)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait |
Method
public Method()
- Empty constructor, all attributes have to be defined via `setXXX'
methods. Use at your own risk.
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.
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
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
dump
public final void dump(java.io.DataOutputStream file)
throws java.io.IOException
- Dump method to file stream on binary format.
- Parameters:
file
- Output file stream
getAccessFlags
public final int getAccessFlags()
- Returns:
- Access flags of the class field.
getAttributes
public final Attribute[] getAttributes()
- Returns:
- Collection of method attributes.
getCode
public final Code getCode()
- Returns:
- Code attribute of method, if any
getExceptionTable
public final ExceptionTable getExceptionTable()
- Returns:
- ExceptionTable attribute of method, if any
getConstantPool
public final ConstantPool getConstantPool()
- Returns:
- Constant pool used by this object.
- See Also:
- ConstantPool
getName
public final java.lang.String getName()
- Returns:
- Name of method
getNameIndex
public final int getNameIndex()
- Returns:
- Index in constant pool of field name.
getSignature
public final java.lang.String getSignature()
- Returns:
- String representation of method type signature.
getSignatureIndex
public final int getSignatureIndex()
- Returns:
- Index in constant pool of field signature.
setAccessFlags
public final void setAccessFlags(int access_flags)
- Parameters:
access_flags.
-
setAttributes
public final void setAttributes(Attribute[] attributes)
- Parameters:
attributes.
-
setConstantPool
public final void setConstantPool(ConstantPool constant_pool)
- Parameters:
constant_pool
- Constant pool to be used for this object.- See Also:
- ConstantPool
setNameIndex
public final void setNameIndex(int name_index)
- Parameters:
name_index.
-
setSignatureIndex
public final void setSignatureIndex(int signature_index)
- Parameters:
signature_index.
-
toString
public final java.lang.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 java.lang.Object
copy
public Method copy(ConstantPool constant_pool)
- Returns:
- deep copy of this method