jellyj.classfile.javaclass
Class ConstantCP

jellyj.classfile.javaclass.Constant
  |
  +--jellyj.classfile.javaclass.ConstantCP
Direct Known Subclasses:
ConstantFieldref, ConstantInterfaceMethodref, ConstantMethodref

public abstract class ConstantCP
extends Constant

Abstract super class for Fieldref and Methodref constants.

Author:
JellyJ Design Group
See Also: ConstantFieldref, ConstantMethodref, ConstantInterfaceMethodref

Constructor Summary
 ConstantCP(ConstantCP c)
          Initialize from another object.
 (package private) ConstantCP(byte tag, DataInputStream file)
          Initialize instance from file data.
 ConstantCP(byte tag, int class_index, int name_and_type_index)
           

Method Summary
 abstract voidaccept(Visitor v)
          Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class.
 final voiddump(DataOutputStream file)
          Dump constant field reference to file stream in binary format.
 final intgetClassIndex()
           
 final intgetNameAndTypeIndex()
           
 final voidsetClassIndex(int class_index)
           
 final voidsetNameAndTypeIndex(int name_and_type_index)
           
 final StringtoString()
           

Methods inherited from class jellyj.classfile.javaclass.Constant
getTag

Constructor Detail

ConstantCP

public ConstantCP(ConstantCP c)
Initialize from another object.

ConstantCP

ConstantCP(byte tag, DataInputStream file)
throws java.io.IOException
Initialize instance from file data.
Parameters:
tag - Constant type tag
file - Input stream
throw IOException

ConstantCP

public ConstantCP(byte tag, int class_index, int name_and_type_index)
Parameters:
class_index - Reference to the class containing the field
name_and_type_index - and the field signature
Method Detail

accept

public abstract 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(DataOutputStream file)
throws java.io.IOException
Dump constant field reference to file stream in binary format.
Parameters:
file - Output file stream
throw IOException

getClassIndex

public final int getClassIndex()
Returns: Reference (index) to class this field belongs to.

getNameAndTypeIndex

public final int getNameAndTypeIndex()
Returns: Reference (index) to signature of the field.

setClassIndex

public final void setClassIndex(int class_index)
Parameters:
class_index.

setNameAndTypeIndex

public final void setNameAndTypeIndex(int name_and_type_index)
Parameters:
name_and_type_index.

toString

public final String toString()
Returns: String representation.