org.apache.bcel.classfile

Class ConstantClass

public final class ConstantClass extends Constant implements ConstantObject

This class is derived from the abstract Constant class and represents a reference to a (external) class.

See Also: Constant

Constructor Summary
ConstantClass(ConstantClass c)
Initialize from another object.
ConstantClass(int name_index)
Method Summary
voidaccept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class.
voiddump(DataOutputStream file)
Dump constant class to file stream in binary format.
StringgetBytes(ConstantPool cp)
ObjectgetConstantValue(ConstantPool cp)
intgetNameIndex()
voidsetNameIndex(int name_index)
StringtoString()

Constructor Detail

ConstantClass

public ConstantClass(ConstantClass c)
Initialize from another object.

ConstantClass

public ConstantClass(int name_index)

Parameters: name_index Name index in constant pool. Should refer to a ConstantUtf8.

Method Detail

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(DataOutputStream file)
Dump constant class to file stream in binary format.

Parameters: file Output file stream

Throws: IOException

getBytes

public String getBytes(ConstantPool cp)

Returns: dereferenced string

getConstantValue

public Object getConstantValue(ConstantPool cp)

Returns: String object

getNameIndex

public final int getNameIndex()

Returns: Name index in constant pool of class name.

setNameIndex

public final void setNameIndex(int name_index)

Parameters: name_index the name index in the constant pool of this Constant Class

toString

public final String toString()

Returns: String representation.