com.vladium.jcd.cls
Class Method_info

java.lang.Object
  extended bycom.vladium.jcd.cls.Method_info
All Implemented Interfaces:
java.lang.Cloneable, IAccessFlags

public final class Method_info
extends java.lang.Object
implements java.lang.Cloneable, IAccessFlags

Each class method, and each instance initialization method , is described by a variable-length method_info structure. The structure has the following format:

  method_info {
          u2 access_flags;
          u2 name_index;
          u2 descriptor_index;
          u2 attributes_count;
          attribute_info attributes[attributes_count];
  }
 
The value of the access_flags item is a mask of modifiers used to describe access permission to and properties of a method or instance initialization method.

The value of the name_index item must be a valid index into the constant pool table. The constant pool entry at that index must be a CONSTANT_Utf8_info structure representing either one of the special internal method names, either <init> or <clinit>, or a valid Java method name, stored as a simple (not fully qualified) name.

The value of the descriptor_index item must be a valid index into the constant pool table. The constant pool entry at that index must be a CONSTANT_Utf8_info structure representing a valid Java method descriptor.

Each value of the attributes table must be a variable-length attribute structure. A method can have any number of optional attributes associated with it. The only attributes defined by this specification for the attributes table of a method_info structure are the Code and Exceptions attributes. See CodeAttribute_info and ExceptionsAttribute_info.

Author:
(C) 2001, Vlad Roubtsov

Field Summary
private  int m_access_flags
           
private  IAttributeCollection m_attributes
           
 int m_descriptor_index
           
 int m_name_index
           
 
Fields inherited from interface com.vladium.jcd.cls.IAccessFlags
ACC_ABSTRACT, ACC_BRIDGE, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_SUPER, ACC_SYNCHRONIZED, ACC_TRANSIENT, ACC_VOLATILE, ALL_ACC, ALL_ACC_NAMES
 
Constructor Summary
Method_info(IConstantCollection constants, UDataInputStream bytes)
           
Method_info(int access_flags, int name_index, int descriptor_index, IAttributeCollection attributes)
           
 
Method Summary
 java.lang.Object clone()
          Performs a deep copy.
 int getAccessFlags()
           
 IAttributeCollection getAttributes()
           
 java.lang.String getDescriptor(ClassDef cls)
          Returns the descriptor string for this method within the context of 'cls' class definition.
 java.lang.String getName(ClassDef cls)
          Returns the method name within the context of 'cls' class definition.
 boolean isAbstract()
           
 boolean isBridge()
           
 boolean isNative()
           
 boolean isSynthetic()
           
 void setAccessFlags(int flags)
           
 java.lang.String toString()
           
 void writeInClassFormat(UDataOutputStream out)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_name_index

public int m_name_index

m_descriptor_index

public int m_descriptor_index

m_access_flags

private int m_access_flags

m_attributes

private IAttributeCollection m_attributes
Constructor Detail

Method_info

public Method_info(int access_flags,
                   int name_index,
                   int descriptor_index,
                   IAttributeCollection attributes)

Method_info

public Method_info(IConstantCollection constants,
                   UDataInputStream bytes)
            throws java.io.IOException
Method Detail

getName

public java.lang.String getName(ClassDef cls)
Returns the method name within the context of 'cls' class definition.

Parameters:
cls - class that contains this method
Returns:
method name

getDescriptor

public java.lang.String getDescriptor(ClassDef cls)
Returns the descriptor string for this method within the context of 'cls' class definition.

Parameters:
cls - class that contains this method
Returns:
field typename descriptor

isNative

public boolean isNative()

isAbstract

public boolean isAbstract()

isSynthetic

public boolean isSynthetic()

isBridge

public boolean isBridge()

setAccessFlags

public final void setAccessFlags(int flags)
Specified by:
setAccessFlags in interface IAccessFlags

getAccessFlags

public final int getAccessFlags()
Specified by:
getAccessFlags in interface IAccessFlags

getAttributes

public IAttributeCollection getAttributes()

toString

public java.lang.String toString()

clone

public java.lang.Object clone()
Performs a deep copy.


writeInClassFormat

public void writeInClassFormat(UDataOutputStream out)
                        throws java.io.IOException
Throws:
java.io.IOException