Package com.tonic.parser
Class FieldEntry
- java.lang.Object
-
- com.tonic.parser.MemberEntry
-
- com.tonic.parser.FieldEntry
-
public class FieldEntry extends MemberEntry
A field entry of a class file, parsed from bytes or built for dynamic creation.
-
-
Constructor Summary
Constructors Constructor Description FieldEntry()Constructs an empty FieldEntry for dynamic creation.FieldEntry(ClassFile classFile)Constructs a FieldEntry by parsing from the class file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(AbstractClassVisitor visitor)Dispatches the visitor to this field.voidsetName(String newName)Renames the field, adding the new name Utf8 to the constant pool and refreshing the key.StringtoString()voidwrite(DataOutputStream dos)Writes this member entry to the output stream.-
Methods inherited from class com.tonic.parser.MemberEntry
getAccess, getAttributes, getClassFile, getDesc, getDescIndex, getKey, getName, getNameIndex, getOwnerName, setAccess, setAttributes, setClassFile, setDesc, setDescIndex, setKey, setNameIndex, setOwnerName
-
-
-
-
Constructor Detail
-
FieldEntry
public FieldEntry()
Constructs an empty FieldEntry for dynamic creation.
-
FieldEntry
public FieldEntry(ClassFile classFile)
Constructs a FieldEntry by parsing from the class file.- Parameters:
classFile- the ClassFile instance being parsed
-
-
Method Detail
-
setName
public void setName(String newName)
Renames the field, adding the new name Utf8 to the constant pool and refreshing the key.- Overrides:
setNamein classMemberEntry- Parameters:
newName- the new field name
-
write
public void write(DataOutputStream dos) throws IOException
Description copied from class:MemberEntryWrites this member entry to the output stream.- Specified by:
writein classMemberEntry- Parameters:
dos- the DataOutputStream to write to- Throws:
IOException- if an I/O error occurs
-
accept
public void accept(AbstractClassVisitor visitor)
Dispatches the visitor to this field.- Parameters:
visitor- the visitor to apply
-
-