Package org.apache.bcel.classfile
Class ConstantCP
- java.lang.Object
-
- org.apache.bcel.classfile.Constant
-
- org.apache.bcel.classfile.ConstantCP
-
- All Implemented Interfaces:
java.lang.Cloneable,Node
- Direct Known Subclasses:
ConstantDynamic,ConstantFieldref,ConstantInterfaceMethodref,ConstantInvokeDynamic,ConstantMethodref
public abstract class ConstantCP extends Constant
Abstract super class for Fieldref, Methodref, InterfaceMethodref and InvokeDynamic constants.
-
-
Field Summary
Fields Modifier and Type Field Description protected intclass_indexDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter.protected intname_and_type_indexDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter.-
Fields inherited from class org.apache.bcel.classfile.Constant
EMPTY_ARRAY, tag
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedConstantCP(byte tag, int classIndex, int nameAndTypeIndex)Constructs a ConstantCP.(package private)ConstantCP(byte tag, java.io.DataInput file)Initialize instance from file data.ConstantCP(ConstantCP c)Initialize from another object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddump(java.io.DataOutputStream file)Dumps constant field reference to file stream in binary format.java.lang.StringgetClass(ConstantPool cp)Gets the class this field belongs to.intgetClassIndex()Gets the reference (index) to class this constant refers to.intgetNameAndTypeIndex()Gets the reference (index) to signature of the field.voidsetClassIndex(int classIndex)Sets the class index.voidsetNameAndTypeIndex(int nameAndTypeIndex)Sets the name and type index.java.lang.StringtoString()-
Methods inherited from class org.apache.bcel.classfile.Constant
accept, clone, copy, equals, getComparator, getTag, hashCode, readConstant, setComparator
-
-
-
-
Field Detail
-
class_index
@Deprecated protected int class_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter.
-
name_and_type_index
@Deprecated protected int name_and_type_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter.
-
-
Constructor Detail
-
ConstantCP
ConstantCP(byte tag, java.io.DataInput file) throws java.io.IOExceptionInitialize instance from file data.- Parameters:
tag- Constant type tag.file- Input stream.- Throws:
java.io.IOException- if an I/O error occurs.
-
ConstantCP
protected ConstantCP(byte tag, int classIndex, int nameAndTypeIndex)Constructs a ConstantCP.- Parameters:
tag- the constant type tag.classIndex- Reference to the class containing the field.nameAndTypeIndex- and the field signature.
-
ConstantCP
public ConstantCP(ConstantCP c)
Initialize from another object.- Parameters:
c- Source to copy.
-
-
Method Detail
-
dump
public final void dump(java.io.DataOutputStream file) throws java.io.IOExceptionDumps constant field reference to file stream in binary format.
-
getClass
public java.lang.String getClass(ConstantPool cp)
Gets the class this field belongs to.- Parameters:
cp- the constant pool.- Returns:
- Class this field belongs to.
-
getClassIndex
public final int getClassIndex()
Gets the reference (index) to class this constant refers to.- Returns:
- Reference (index) to class this constant refers to.
-
getNameAndTypeIndex
public final int getNameAndTypeIndex()
Gets the reference (index) to signature of the field.- Returns:
- Reference (index) to signature of the field.
-
setClassIndex
public final void setClassIndex(int classIndex)
Sets the class index.- Parameters:
classIndex- points to Constant_class.
-
setNameAndTypeIndex
public final void setNameAndTypeIndex(int nameAndTypeIndex)
Sets the name and type index.- Parameters:
nameAndTypeIndex- points to Constant_NameAndType.
-
-