final class FieldWriter extends FieldVisitor
FieldVisitor
that generates a corresponding 'field_info' structure, as defined in the
Java Virtual Machine Specification (JVMS).Modifier and Type | Field and Description |
---|---|
private int |
accessFlags
The access_flags field of the field_info JVMS structure.
|
private int |
constantValueIndex
The constantvalue_index field of the ConstantValue attribute of this field_info, or 0 if there
is no ConstantValue attribute.
|
private int |
descriptorIndex
The descriptor_index field of the field_info JVMS structure.
|
private Attribute |
firstAttribute
The first non standard attribute of this field.
|
private AnnotationWriter |
lastRuntimeInvisibleAnnotation
The last runtime invisible annotation of this field.
|
private AnnotationWriter |
lastRuntimeInvisibleTypeAnnotation
The last runtime invisible type annotation of this field.
|
private AnnotationWriter |
lastRuntimeVisibleAnnotation
The last runtime visible annotation of this field.
|
private AnnotationWriter |
lastRuntimeVisibleTypeAnnotation
The last runtime visible type annotation of this field.
|
private int |
nameIndex
The name_index field of the field_info JVMS structure.
|
private int |
signatureIndex
The signature_index field of the Signature attribute of this field_info, or 0 if there is no
Signature attribute.
|
private SymbolTable |
symbolTable
Where the constants used in this FieldWriter must be stored.
|
api, fv
Constructor and Description |
---|
FieldWriter(SymbolTable symbolTable,
int access,
java.lang.String name,
java.lang.String descriptor,
java.lang.String signature,
java.lang.Object constantValue)
Constructs a new
FieldWriter . |
Modifier and Type | Method and Description |
---|---|
(package private) void |
collectAttributePrototypes(Attribute.Set attributePrototypes)
Collects the attributes of this field into the given set of attribute prototypes.
|
(package private) int |
computeFieldInfoSize()
Returns the size of the field_info JVMS structure generated by this FieldWriter.
|
(package private) void |
putFieldInfo(ByteVector output)
Puts the content of the field_info JVMS structure generated by this FieldWriter into the given
ByteVector.
|
AnnotationVisitor |
visitAnnotation(java.lang.String descriptor,
boolean visible)
Visits an annotation of the field.
|
void |
visitAttribute(Attribute attribute)
Visits a non standard attribute of the field.
|
void |
visitEnd()
Visits the end of the field.
|
AnnotationVisitor |
visitTypeAnnotation(int typeRef,
TypePath typePath,
java.lang.String descriptor,
boolean visible)
Visits an annotation on the type of the field.
|
private final SymbolTable symbolTable
private final int accessFlags
Opcodes.ACC_DEPRECATED
, which are removed when generating the
ClassFile structure.private final int nameIndex
private final int descriptorIndex
private int signatureIndex
private int constantValueIndex
private AnnotationWriter lastRuntimeVisibleAnnotation
AnnotationWriter.previousAnnotation
field. May be null.private AnnotationWriter lastRuntimeInvisibleAnnotation
AnnotationWriter.previousAnnotation
field. May be null.private AnnotationWriter lastRuntimeVisibleTypeAnnotation
AnnotationWriter.previousAnnotation
field. May be null.private AnnotationWriter lastRuntimeInvisibleTypeAnnotation
AnnotationWriter.previousAnnotation
field. May be null.private Attribute firstAttribute
Attribute.nextAttribute
field. May be null.
WARNING: this list stores the attributes in the reverse order of their visit.
firstAttribute is actually the last attribute visited in visitAttribute(org.springframework.asm.Attribute)
. The putFieldInfo(org.springframework.asm.ByteVector)
method writes the attributes in the order defined by this list, i.e. in the
reverse order specified by the user.
FieldWriter(SymbolTable symbolTable, int access, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.Object constantValue)
FieldWriter
.symbolTable
- where the constants used in this FieldWriter must be stored.access
- the field's access flags (see Opcodes
).name
- the field's name.descriptor
- the field's descriptor (see Type
).signature
- the field's signature. May be null.constantValue
- the field's constant value. May be null.public AnnotationVisitor visitAnnotation(java.lang.String descriptor, boolean visible)
FieldVisitor
visitAnnotation
in class FieldVisitor
descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, java.lang.String descriptor, boolean visible)
FieldVisitor
visitTypeAnnotation
in class FieldVisitor
typeRef
- a reference to the annotated type. The sort of this type reference must be
TypeReference.FIELD
. See TypeReference
.typePath
- the path to the annotated type argument, wildcard bound, array element type, or
static inner type within 'typeRef'. May be null if the annotation targets
'typeRef' as a whole.descriptor
- the class descriptor of the annotation class.visible
- true if the annotation is visible at runtime.public void visitAttribute(Attribute attribute)
FieldVisitor
visitAttribute
in class FieldVisitor
attribute
- an attribute.public void visitEnd()
FieldVisitor
visitEnd
in class FieldVisitor
int computeFieldInfoSize()
void putFieldInfo(ByteVector output)
output
- where the field_info structure must be put.final void collectAttributePrototypes(Attribute.Set attributePrototypes)
attributePrototypes
- a set of attribute prototypes.