Class ConstantNameAndType
java.lang.Object
org.apache.bcel.classfile.Constant
org.apache.bcel.classfile.ConstantNameAndType
This class is derived from the abstract
Constant and represents a reference to the name and signature of a
field or method.- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstantNameAndType(int nameIndex, int signatureIndex) Constructs a ConstantNameAndType.Initialize from another object. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.voiddump(DataOutputStream file) Dumps name and signature index to file stream in binary format.getName(ConstantPool cp) Gets the name.intGets the name index in constant pool of field/method name.Gets the signature.intGets the index in constant pool of field/method signature.voidsetNameIndex(int nameIndex) Sets the name index.voidsetSignatureIndex(int signatureIndex) Sets the signature index.toString()Methods inherited from class Constant
clone, copy, equals, getComparator, getTag, hashCode, readConstant, setComparatorModifier and TypeMethodDescriptionclone()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.
-
Constructor Details
-
ConstantNameAndType
Initialize from another object.- Parameters:
c- Source to copy.
-
ConstantNameAndType
Constructs a ConstantNameAndType.- Parameters:
nameIndex- Name of field/method.signatureIndex- and its signature.
-
-
Method Details
-
accept
Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. That is, the hierarchy of methods, fields, attributes, and other elements forms a tree of objects. -
dump
Dumps name and signature index to file stream in binary format.- Specified by:
dumpin classConstant- Parameters:
file- Output file stream.- Throws:
IOException- Thrown if an I/O error occurs.
-
getName
Gets the name.- Parameters:
cp- The constant pool.- Returns:
- name.
-
getNameIndex
Gets the name index in constant pool of field/method name.- Returns:
- Name index in constant pool of field/method name.
-
getSignature
Gets the signature.- Parameters:
cp- The constant pool.- Returns:
- signature.
-
getSignatureIndex
Gets the index in constant pool of field/method signature.- Returns:
- Index in constant pool of field/method signature.
-
setNameIndex
Sets the name index.- Parameters:
nameIndex- The name index of this constant.
-
setSignatureIndex
Sets the signature index.- Parameters:
signatureIndex- The signature index in the constant pool of this type.
-
toString
-