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

public abstract Class ConstantCP

extends Constant
Class Inheritance
Known Direct Subclasses
org.apache.bcel.classfile.ConstantDynamic, org.apache.bcel.classfile.ConstantFieldref, org.apache.bcel.classfile.ConstantInterfaceMethodref, org.apache.bcel.classfile.ConstantInvokeDynamic, org.apache.bcel.classfile.ConstantMethodref
Imports
java.io.DataInput, .DataOutputStream, .IOException, org.apache.bcel.Const

Abstract super class for Fieldref, Methodref, InterfaceMethodref and InvokeDynamic constants.
See Also
ConstantFieldref, ConstantMethodref, ConstantInterfaceMethodref, ConstantInvokeDynamic

Field Summary

Modifier and TypeField and Description
protected int
class_index

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
protected int
name_and_type_index

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
Inherited from org.apache.bcel.classfile.Constant:
tag

Constructor Summary

AccessConstructor and Description
pack-priv
ConstantCP(final byte
Constant type tag
tag
,
final DataInput
Input stream
file
)

Initialize instance from file data.

protected
ConstantCP(final byte tag, final int
Reference to the class containing the field
classIndex
,
final int
and the field signature
nameAndTypeIndex
)

public
ConstantCP(final ConstantCP
Source to copy.
c
)

Initialize from another object.

Method Summary

Modifier and TypeMethod and Description
public final void
dump(final DataOutputStream
Output file stream
file
)

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

Dump constant field reference to file stream in binary format.
public String

Returns:

Class this field belongs to.
getClass
(final ConstantPool cp)

public final int

Returns:

Reference (index) to class this constant refers to.
getClassIndex
()

public final int

Returns:

Reference (index) to signature of the field.
getNameAndTypeIndex
()

public final void
setClassIndex(final int
points to Constant_class
classIndex
)

public final void
setNameAndTypeIndex(final int
points to Constant_NameAndType
nameAndTypeIndex
)

public String

Returns:

String representation. not final as ConstantInvokeDynamic needs to modify
toString
()

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

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

Field Detail

class_indexback to summary
protected int class_index

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
name_and_type_indexback to summary
protected int name_and_type_index

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated

Constructor Detail

ConstantCPback to summary
pack-priv ConstantCP(final byte tag, final DataInput file) throws IOException

Initialize instance from file data.

Parameters
tag:byte

Constant type tag

file:DataInput

Input stream

Exceptions
IOException:
if an I/O error occurs.
ConstantCPback to summary
protected ConstantCP(final byte tag, final int classIndex, final int nameAndTypeIndex)
Parameters
classIndex:int

Reference to the class containing the field

nameAndTypeIndex:int

and the field signature

ConstantCPback to summary
public ConstantCP(final ConstantCP c)

Initialize from another object.

Parameters
c:ConstantCP

Source to copy.

Method Detail

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

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

Dump constant field reference to file stream in binary format.

Parameters
file:DataOutputStream

Output file stream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
getClassback to summary
public String getClass(final ConstantPool cp)
Returns:String

Class this field belongs to.

getClassIndexback to summary
public final int getClassIndex()
Returns:int

Reference (index) to class this constant refers to.

getNameAndTypeIndexback to summary
public final int getNameAndTypeIndex()
Returns:int

Reference (index) to signature of the field.

setClassIndexback to summary
public final void setClassIndex(final int classIndex)
Parameters
classIndex:int

points to Constant_class

setNameAndTypeIndexback to summary
public final void setNameAndTypeIndex(final int nameAndTypeIndex)
Parameters
nameAndTypeIndex:int

points to Constant_NameAndType

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. not final as ConstantInvokeDynamic needs to modify

Annotations
@Override