APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.classfile

public abstract Class ConstantCP

extends Constant
Class Inheritance
Known Direct Subclasses
com.sun.org.apache.bcel.internal.classfile.ConstantDynamic, com.sun.org.apache.bcel.internal.classfile.ConstantFieldref, com.sun.org.apache.bcel.internal.classfile.ConstantInterfaceMethodref, com.sun.org.apache.bcel.internal.classfile.ConstantInvokeDynamic, com.sun.org.apache.bcel.internal.classfile.ConstantMethodref
Imports
java.io.DataInput, .DataOutputStream, .IOException, com.sun.org.apache.bcel.internal.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 com.sun.org.apache.bcel.internal.classfile.Constant:
EMPTY_ARRAYtag

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 com.sun.org.apache.bcel.internal.classfile.Constant.dump.

Dump constant field reference to file stream in binary format.

public String
getClass(final ConstantPool cp)

Returns: Class this field belongs to.

public final int
getClassIndex()

Returns: Reference (index) to class this constant refers to.

public final int
getNameAndTypeIndex()

Returns: Reference (index) to signature of the field.

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 com.sun.org.apache.bcel.internal.classfile.Constant.toString.

Returns a string representation of the object.

Inherited from com.sun.org.apache.bcel.internal.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 com.sun.org.apache.bcel.internal.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 com.sun.org.apache.bcel.internal.classfile.Constant.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

String representation. not final as ConstantInvokeDynamic needs to modify

Annotations
@Override