Package net.bytebuddy.asm
Class MemberAttributeExtension.ForField
java.lang.Object
net.bytebuddy.asm.MemberAttributeExtension<FieldAttributeAppender.Factory>
net.bytebuddy.asm.MemberAttributeExtension.ForField
- All Implemented Interfaces:
AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper
- Enclosing class:
MemberAttributeExtension<T>
public static class MemberAttributeExtension.ForField
extends MemberAttributeExtension<FieldAttributeAppender.Factory>
implements AsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper
A visitor that adds attributes to a field.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA field visitor to apply an field attribute appender.Nested classes/interfaces inherited from class net.bytebuddy.asm.MemberAttributeExtension
MemberAttributeExtension.ForField, MemberAttributeExtension.ForMethod -
Field Summary
Fields inherited from class net.bytebuddy.asm.MemberAttributeExtension
annotationValueFilterFactory, attributeAppenderFactory -
Constructor Summary
ConstructorsModifierConstructorDescriptionForField()Creates a field attribute extension that appends default values of annotations.ForField(AnnotationValueFilter.Factory annotationValueFilterFactory) Creates a field attribute extension.protectedForField(AnnotationValueFilter.Factory annotationValueFilterFactory, FieldAttributeAppender.Factory attributeAppenderFactory) Creates a field attribute extension. -
Method Summary
Modifier and TypeMethodDescriptionannotate(Annotation... annotation) Appends the supplied annotations.annotate(Collection<? extends AnnotationDescription> annotations) Appends the supplied annotations.annotate(List<? extends Annotation> annotations) Appends the supplied annotations.annotate(AnnotationDescription... annotation) Appends the supplied annotations.attribute(FieldAttributeAppender.Factory attributeAppenderFactory) Appends the supplied attribute appender factory.on(ElementMatcher<? super FieldDescription.InDefinedShape> matcher) Applies this attribute extension on any field that matches the supplied matcher.org.objectweb.asm.FieldVisitorwrap(TypeDescription instrumentedType, FieldDescription.InDefinedShape fieldDescription, org.objectweb.asm.FieldVisitor fieldVisitor) Wraps a field visitor.
-
Constructor Details
-
ForField
public ForField()Creates a field attribute extension that appends default values of annotations. -
ForField
Creates a field attribute extension.- Parameters:
annotationValueFilterFactory- The annotation value filter factory to apply.
-
ForField
protected ForField(AnnotationValueFilter.Factory annotationValueFilterFactory, FieldAttributeAppender.Factory attributeAppenderFactory) Creates a field attribute extension.- Parameters:
annotationValueFilterFactory- The annotation value filter factory to apply.attributeAppenderFactory- The field attribute appender factory to use.
-
-
Method Details
-
annotate
Appends the supplied annotations.- Parameters:
annotation- The annotations to append.- Returns:
- A new field attribute extension that appends any previously registered attributes and the supplied annotations.
-
annotate
Appends the supplied annotations.- Parameters:
annotations- The annotations to append.- Returns:
- A new field attribute extension that appends any previously registered attributes and the supplied annotations.
-
annotate
Appends the supplied annotations.- Parameters:
annotation- The annotations to append.- Returns:
- A new field attribute extension that appends any previously registered attributes and the supplied annotations.
-
annotate
public MemberAttributeExtension.ForField annotate(Collection<? extends AnnotationDescription> annotations) Appends the supplied annotations.- Parameters:
annotations- The annotations to append.- Returns:
- A new field attribute extension that appends any previously registered attributes and the supplied annotations.
-
attribute
public MemberAttributeExtension.ForField attribute(FieldAttributeAppender.Factory attributeAppenderFactory) Appends the supplied attribute appender factory.- Parameters:
attributeAppenderFactory- The attribute appender factory to append.- Returns:
- A new field attribute extension that appends any previously registered attributes and the supplied annotations.
-
wrap
public org.objectweb.asm.FieldVisitor wrap(TypeDescription instrumentedType, FieldDescription.InDefinedShape fieldDescription, org.objectweb.asm.FieldVisitor fieldVisitor) Wraps a field visitor.- Specified by:
wrapin interfaceAsmVisitorWrapper.ForDeclaredFields.FieldVisitorWrapper- Parameters:
instrumentedType- The instrumented type.fieldDescription- The field that is currently being defined.fieldVisitor- The original field visitor that defines the given field.- Returns:
- The wrapped field visitor.
-
on
Applies this attribute extension on any field that matches the supplied matcher.- Parameters:
matcher- The matcher that decides what fields the represented extension is applied to.- Returns:
- An appropriate ASM visitor wrapper.
-