Package com.tonic.parser.constpool
Class ConstantDynamicItem
- java.lang.Object
-
- com.tonic.parser.constpool.Item<ConstantDynamic>
-
- com.tonic.parser.constpool.ConstantDynamicItem
-
public class ConstantDynamicItem extends Item<ConstantDynamic>
Represents a CONSTANT_Dynamic entry in the constant pool (tag 17/0x11).
-
-
Field Summary
-
Fields inherited from class com.tonic.parser.constpool.Item
ITEM_CLASS_REF, ITEM_DOUBLE, ITEM_DYNAMIC, ITEM_FIELD_REF, ITEM_FLOAT, ITEM_INTEGER, ITEM_INTERFACE_REF, ITEM_INVOKEDYNAMIC, ITEM_LONG, ITEM_METHOD_HANDLE, ITEM_METHOD_REF, ITEM_METHOD_TYPE, ITEM_MODULE, ITEM_NAME_TYPE_REF, ITEM_PACKAGE, ITEM_STRING_REF, ITEM_UTF_8
-
-
Constructor Summary
Constructors Constructor Description ConstantDynamicItem()Default constructor for reading from class file.ConstantDynamicItem(ConstantDynamic value)Constructor for programmatic creation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBootstrapMethodAttrIndex()Gets the bootstrap method attribute index.StringgetDescriptor()Retrieves the descriptor from the constant pool.StringgetName()Retrieves the name from the constant pool.bytegetType()Returns the type of the constant pool item.ConstantDynamicgetValue()Returns the value held by the constant pool item.voidread(ClassFile classFile)Reads the constant pool item from the class file.voidsetConstPool(ConstPool constPool)Sets the constant pool reference for name/descriptor resolution.voidsetValue(ConstantDynamic value)Sets the ConstantDynamic value.voidwrite(DataOutputStream dos)Writes the item to the output stream (excluding the tag byte, which is written by the caller).-
Methods inherited from class com.tonic.parser.constpool.Item
accept, getIndex, setClassFile
-
-
-
-
Constructor Detail
-
ConstantDynamicItem
public ConstantDynamicItem()
Default constructor for reading from class file.
-
ConstantDynamicItem
public ConstantDynamicItem(ConstantDynamic value)
Constructor for programmatic creation.- Parameters:
value- the ConstantDynamic value
-
-
Method Detail
-
setValue
public void setValue(ConstantDynamic value)
Sets the ConstantDynamic value.- Parameters:
value- the value to set
-
setConstPool
public void setConstPool(ConstPool constPool)
Sets the constant pool reference for name/descriptor resolution.- Parameters:
constPool- the constant pool
-
read
public void read(ClassFile classFile)
Description copied from class:ItemReads the constant pool item from the class file.- Specified by:
readin classItem<ConstantDynamic>- Parameters:
classFile- The ClassFile utility to read data.
-
write
public void write(DataOutputStream dos) throws IOException
Description copied from class:ItemWrites the item to the output stream (excluding the tag byte, which is written by the caller).- Specified by:
writein classItem<ConstantDynamic>- Parameters:
dos- The output stream to write to.- Throws:
IOException- If an I/O error occurs.
-
getType
public byte getType()
Description copied from class:ItemReturns the type of the constant pool item.- Specified by:
getTypein classItem<ConstantDynamic>- Returns:
- The constant pool tag.
-
getValue
public ConstantDynamic getValue()
Description copied from class:ItemReturns the value held by the constant pool item.- Specified by:
getValuein classItem<ConstantDynamic>- Returns:
- The value of type T.
-
getName
public String getName()
Retrieves the name from the constant pool.- Returns:
- the name of the dynamic constant
-
getDescriptor
public String getDescriptor()
Retrieves the descriptor from the constant pool.- Returns:
- the descriptor of the dynamic constant
-
getBootstrapMethodAttrIndex
public int getBootstrapMethodAttrIndex()
Gets the bootstrap method attribute index.- Returns:
- the bootstrap method index
-
-