org.apache.bcel.classfile

Class ConstantCP

public abstract class ConstantCP extends Constant

Abstract super class for Fieldref and Methodref constants.

Version: $Id: ConstantCP.java 386056 2006-03-15 11:31:56Z tcurdt $

Author: M. Dahm

See Also: ConstantFieldref ConstantMethodref ConstantInterfaceMethodref

Field Summary
protected intclass_index
References to the constants containing the class and the field signature
protected intname_and_type_index
References to the constants containing the class and the field signature
Constructor Summary
ConstantCP(ConstantCP c)
Initialize from another object.
ConstantCP(byte tag, DataInputStream file)
Initialize instance from file data.
protected ConstantCP(byte tag, int class_index, int name_and_type_index)
Method Summary
voiddump(DataOutputStream file)
Dump constant field reference to file stream in binary format.
StringgetClass(ConstantPool cp)
intgetClassIndex()
intgetNameAndTypeIndex()
voidsetClassIndex(int class_index)
voidsetNameAndTypeIndex(int name_and_type_index)
StringtoString()

Field Detail

class_index

protected int class_index
References to the constants containing the class and the field signature

name_and_type_index

protected int name_and_type_index
References to the constants containing the class and the field signature

Constructor Detail

ConstantCP

public ConstantCP(ConstantCP c)
Initialize from another object.

ConstantCP

ConstantCP(byte tag, DataInputStream file)
Initialize instance from file data.

Parameters: tag Constant type tag file Input stream

Throws: IOException

ConstantCP

protected 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

dump

public final void dump(DataOutputStream file)
Dump constant field reference to file stream in binary format.

Parameters: file Output file stream

Throws: IOException

getClass

public String getClass(ConstantPool cp)

Returns: Class this field belongs to.

getClassIndex

public final int getClassIndex()

Returns: Reference (index) to class this field or method 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 points to Constant_class

setNameAndTypeIndex

public final void setNameAndTypeIndex(int name_and_type_index)

Parameters: name_and_type_index points to Constant_NameAndType

toString

public final String toString()

Returns: String representation.