Class Constant
java.lang.Object
org.apache.bcel.classfile.Constant
- Direct Known Subclasses:
ConstantClass, ConstantCP, ConstantDouble, ConstantFloat, ConstantInteger, ConstantLong, ConstantMethodHandle, ConstantMethodType, ConstantModule, ConstantNameAndType, ConstantPackage, ConstantString, ConstantUtf8
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byteDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter. -
Method Summary
Modifier 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.abstract voiddump(DataOutputStream file) Dumps constant to file stream in binary format.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.toString()
-
Field Details
-
tag
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter.
-
-
Method Details
-
getComparator
Gets the comparison strategy object.- Returns:
- Comparison strategy object.
-
readConstant
Reads one constant from the given input, the type depends on a tag byte.- Parameters:
dataInput- Input stream.- Returns:
- Constant object.
- Throws:
IOException- if an I/O error occurs reading from the givendataInput.ClassFormatException- if the next byte is not recognized- Since:
- 6.0 made public
-
setComparator
Sets the comparison strategy object.- Parameters:
comparator- Comparison strategy object.
-
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. -
clone
-
copy
-
dump
Dumps constant to file stream in binary format.- Parameters:
file- the output stream.- Throws:
IOException- if an I/O error occurs.
-
equals
-
getTag
Gets the tag of constant.- Returns:
- Tag of constant, that is, its type. No setTag() method to avoid confusion.
-
hashCode
-
toString
-