Top Description Fields Constructors Methods
org.apache.bcel.classfile

public final Class ConstantClass

extends Constant
implements ConstantObject
Class Inheritance
All Implemented Interfaces
org.apache.bcel.classfile.ConstantObject
Imports
java.io.DataInput, .DataOutputStream, .IOException, org.apache.bcel.Const

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

Field Summary

Modifier and TypeField and Description
private int
Inherited from org.apache.bcel.classfile.Constant:
tag

Constructor Summary

AccessConstructor and Description
public
ConstantClass(final ConstantClass
Source to copy.
c
)

Initialize from another object.

pack-priv
ConstantClass(final DataInput
Input stream
dataInput
)

Constructs an instance from file data.

public
ConstantClass(final int
Name index in constant pool. Should refer to a ConstantUtf8.
nameIndex
)

Method Summary

Modifier and TypeMethod and Description
public void
accept(final Visitor
Visitor object
v
)

Implements abstract org.apache.bcel.classfile.Constant.accept.

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.
public void
dump(final DataOutputStream
Output file stream
file
)

Implements abstract org.apache.bcel.classfile.Constant.dump.

Dumps constant class to file stream in binary format.
public String

Returns:

dereferenced string
getBytes
(final ConstantPool cp)

public Object

Returns:

String object
getConstantValue
(final ConstantPool
the constant.
cp
)

Implements org.apache.bcel.classfile.ConstantObject.getConstantValue.

Gets the object representing the constant, e.g., Long for ConstantLong.
public int

Returns:

Name index in constant pool of class name.
getNameIndex
()

public void
setNameIndex(final int
the name index in the constant pool of this Constant Class
nameIndex
)

public String

Returns:

String representation.
toString
()

Overrides org.apache.bcel.classfile.Constant.toString.

Returns a string representation of the object.
Inherited from org.apache.bcel.classfile.Constant:
clonecopyequalsgetComparatorgetTaghashCodereadConstantsetComparator

Field Detail

nameIndexback to summary
private int nameIndex

Constructor Detail

ConstantClassback to summary
public ConstantClass(final ConstantClass c)

Initialize from another object.

Parameters
c:ConstantClass

Source to copy.

ConstantClassback to summary
pack-priv ConstantClass(final DataInput dataInput) throws IOException

Constructs an instance from file data.

Parameters
dataInput:DataInput

Input stream

Exceptions
IOException:
if an I/O error occurs reading from the given dataInput.
ConstantClassback to summary
public ConstantClass(final int nameIndex)
Parameters
nameIndex:int

Name index in constant pool. Should refer to a ConstantUtf8.

Method Detail

acceptback to summary
public void accept(final Visitor v)

Implements abstract org.apache.bcel.classfile.Constant.accept.

Implements org.apache.bcel.classfile.Node.accept.

Called by objects that are traversing the nodes of the tree implicitly 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

Visitor object

Annotations
@Override
dumpback to summary
public void dump(final DataOutputStream file) throws IOException

Implements abstract org.apache.bcel.classfile.Constant.dump.

Dumps constant class to file stream in binary format.

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs writing to the DataOutputStream.
getBytesback to summary
public String getBytes(final ConstantPool cp)
Returns:String

dereferenced string

getConstantValueback to summary
public Object getConstantValue(final ConstantPool cp)

Implements org.apache.bcel.classfile.ConstantObject.getConstantValue.

Doc from org.apache.bcel.classfile.ConstantObject.getConstantValue.

Gets the object representing the constant, e.g., Long for ConstantLong.

Parameters
cp:ConstantPool

the constant.

Returns:Object

String object

Annotations
@Override
getNameIndexback to summary
public int getNameIndex()
Returns:int

Name index in constant pool of class name.

setNameIndexback to summary
public void setNameIndex(final int nameIndex)
Parameters
nameIndex:int

the name index in the constant pool of this Constant Class

toStringback to summary
public String toString()

Overrides org.apache.bcel.classfile.Constant.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

String representation.

Annotations
@Override