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, setComparator
-
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. I.e., the hierarchy of methods, fields, attributes, etc. spawns 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- 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
-