Package com.tonic.parser.constpool
Class FieldRefItem
- java.lang.Object
-
- com.tonic.parser.constpool.Item<FieldRef>
-
- com.tonic.parser.constpool.FieldRefItem
-
-
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 FieldRefItem()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetClassName()Gets the class name from constant pool.StringgetDescriptor()Gets the field descriptor from constant pool.StringgetName()Gets the field name from constant pool.StringgetOwner()Gets owner class internal name from constant pool.bytegetType()Returns the type of the constant pool item.FieldRefgetValue()Returns the value held by the constant pool item.voidread(ClassFile classFile)Reads the constant pool item from the class file.voidsetClassIndex(int classIndex)Repoints this field reference at a different owner class (constant-pool class index).voidsetValue(FieldRef value)Replaces the referenced class and name-and-type pair wholesale.StringtoString()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
-
-
-
-
Method Detail
-
setValue
public void setValue(FieldRef value)
Replaces the referenced class and name-and-type pair wholesale.- Parameters:
value- new field reference
-
read
public void read(ClassFile classFile)
Description copied from class:ItemReads the constant pool item from the class file.
-
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<FieldRef>- 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.
-
getValue
public FieldRef getValue()
Description copied from class:ItemReturns the value held by the constant pool item.
-
setClassIndex
public void setClassIndex(int classIndex)
Repoints this field reference at a different owner class (constant-pool class index).- Parameters:
classIndex- the new CONSTANT_Class index
-
getClassName
public String getClassName()
Gets the class name from constant pool.- Returns:
- class name or null if unavailable
-
getName
public String getName()
Gets the field name from constant pool.- Returns:
- field name or null if unavailable
-
getDescriptor
public String getDescriptor()
Gets the field descriptor from constant pool.- Returns:
- field descriptor or null if unavailable
-
getOwner
public String getOwner()
Gets owner class internal name from constant pool.- Returns:
- owner class internal name or null if unavailable
-
-