Package com.tonic.parser.attribute
Class RecordAttribute
- java.lang.Object
-
- com.tonic.parser.attribute.Attribute
-
- com.tonic.parser.attribute.RecordAttribute
-
public class RecordAttribute extends Attribute
The Record attribute.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRecordAttribute.ComponentA record component: name and descriptor Utf8 indices plus per-component attributes.
-
Constructor Summary
Constructors Constructor Description RecordAttribute(String name, ClassFile hostClass, int nameIndex, int length)Creates the attribute shell for parsing, attached to a class.RecordAttribute(String name, MemberEntry parent, int nameIndex, int length)Creates the attribute shell for parsing, attached to a member.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String[]>getComponentNameAndDescriptors()Resolves every component's name and descriptor against the constant pool.List<RecordAttribute.Component>getComponents()voidread(ClassFile classFile, int length)Reads the attribute data from the class file.StringtoString()voidupdateLength()Recomputes the attribute length field from the current in-memory content.
-
-
-
Constructor Detail
-
RecordAttribute
public RecordAttribute(String name, MemberEntry parent, int nameIndex, int length)
Creates the attribute shell for parsing, attached to a member.- Parameters:
name- the attribute nameparent- the member the attribute belongs tonameIndex- constant-pool index of the name Utf8length- the attribute length in bytes
-
RecordAttribute
public RecordAttribute(String name, ClassFile hostClass, int nameIndex, int length)
Creates the attribute shell for parsing, attached to a class.- Parameters:
name- the attribute namehostClass- the class the attribute belongs tonameIndex- constant-pool index of the name Utf8length- the attribute length in bytes
-
-
Method Detail
-
getComponents
public List<RecordAttribute.Component> getComponents()
- Returns:
- the components
-
read
public void read(ClassFile classFile, int length)
Description copied from class:AttributeReads the attribute data from the class file.
-
updateLength
public void updateLength()
Description copied from class:AttributeRecomputes the attribute length field from the current in-memory content.- Specified by:
updateLengthin classAttribute
-
getComponentNameAndDescriptors
public List<String[]> getComponentNameAndDescriptors()
Resolves every component's name and descriptor against the constant pool.- Returns:
- one {name, descriptor} pair per component in declaration order, with "Unknown" substituted for an index that is not a UTF-8 entry
-
-