Class ConstantCP
java.lang.Object
org.apache.bcel.classfile.Constant
org.apache.bcel.classfile.ConstantCP
- Direct Known Subclasses:
ConstantDynamic, ConstantFieldref, ConstantInterfaceMethodref, ConstantInvokeDynamic, ConstantMethodref
Abstract superclass for Fieldref, Methodref, InterfaceMethodref and InvokeDynamic constants.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter.protected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstantCP(byte tag, int classIndex, int nameAndTypeIndex) Constructs a ConstantCP.Initialize from another object. -
Method Summary
Modifier and TypeMethodDescriptionfinal voiddump(DataOutputStream file) Dumps constant field reference to file stream in binary format.getClass(ConstantPool cp) Gets the class this field belongs to.final intGets the reference (index) to class this constant refers to.final intGets the reference (index) to signature of the field.final voidsetClassIndex(int classIndex) Sets the class index.final voidsetNameAndTypeIndex(int nameAndTypeIndex) Sets the name and type index.toString()Methods inherited from class Constant
accept, clone, copy, equals, getComparator, getTag, hashCode, readConstant, setComparatorModifier and TypeMethodDescriptionabstract voidCalled by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.clone()copy()Creates a deep copy of this constant.booleanReturns value as defined by given BCELComparator strategy.static BCELComparator<Constant> Gets the comparison strategy object.final bytegetTag()Gets the tag of constant.inthashCode()Returns value as defined by given BCELComparator strategy.static ConstantreadConstant(DataInput dataInput) Reads one constant from the given input, the type depends on a tag byte.static voidsetComparator(BCELComparator<Constant> comparator) Sets the comparison strategy object.
-
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
Constructs a ConstantCP.- Parameters:
tag- The constant type tag.classIndex- Reference to the class containing the field.nameAndTypeIndex- and the field signature.
-
ConstantCP
-
-
Method Details
-
dump
Dumps constant field reference to file stream in binary format.- Specified by:
dumpin classConstant- Parameters:
file- Output file stream.- Throws:
IOException- Thrown if an I/O error occurs.
-
getClass
Gets the class this field belongs to.- Parameters:
cp- The constant pool.- Returns:
- Class this field belongs to.
-
getClassIndex
Gets the reference (index) to class this constant refers to.- Returns:
- Reference (index) to class this constant refers to.
-
getNameAndTypeIndex
Gets the reference (index) to signature of the field.- Returns:
- Reference (index) to signature of the field.
-
setClassIndex
Sets the class index.- Parameters:
classIndex- points to Constant_class.
-
setNameAndTypeIndex
Sets the name and type index.- Parameters:
nameAndTypeIndex- points to Constant_NameAndType.
-
toString
-