Package org.apache.bcel.classfile
Class ConstantCP
java.lang.Object
org.apache.bcel.classfile.Constant
org.apache.bcel.classfile.ConstantCP
- Direct Known Subclasses:
ConstantDynamic
,ConstantFieldref
,ConstantInterfaceMethodref
,ConstantInvokeDynamic
,ConstantMethodref
Abstract super class for Fieldref, Methodref, InterfaceMethodref and InvokeDynamic constants.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected int
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ConstantCP
(byte tag, int classIndex, int nameAndTypeIndex) (package private)
ConstantCP
(byte tag, DataInput file) Initialize instance from file data.Initialize from another object. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
dump
(DataOutputStream file) Dump constant field reference to file stream in binary format.getClass
(ConstantPool cp) final int
final int
final void
setClassIndex
(int classIndex) final void
setNameAndTypeIndex
(int nameAndTypeIndex) toString()
Methods inherited from class org.apache.bcel.classfile.Constant
accept, clone, copy, equals, getComparator, getTag, hashCode, readConstant, setComparator
-
Field Details
-
class_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
name_and_type_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
-
Constructor Details
-
ConstantCP
ConstantCP(byte tag, DataInput file) throws IOException Initialize instance from file data.- Parameters:
tag
- Constant type tagfile
- Input stream- Throws:
IOException
- if an I/O error occurs.
-
ConstantCP
protected ConstantCP(byte tag, int classIndex, int nameAndTypeIndex) - Parameters:
classIndex
- Reference to the class containing the fieldnameAndTypeIndex
- and the field signature
-
ConstantCP
Initialize from another object.- Parameters:
c
- Source to copy.
-
-
Method Details
-
dump
Dump constant field reference to file stream in binary format.- Specified by:
dump
in classConstant
- Parameters:
file
- Output file stream- Throws:
IOException
- if an I/O error occurs.
-
getClass
- Returns:
- Class this field belongs to.
-
getClassIndex
public final int getClassIndex()- Returns:
- Reference (index) to class this constant refers to.
-
getNameAndTypeIndex
public final int getNameAndTypeIndex()- Returns:
- Reference (index) to signature of the field.
-
setClassIndex
public final void setClassIndex(int classIndex) - Parameters:
classIndex
- points to Constant_class
-
setNameAndTypeIndex
public final void setNameAndTypeIndex(int nameAndTypeIndex) - Parameters:
nameAndTypeIndex
- points to Constant_NameAndType
-
toString
-