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 Classes Modifier and Type Class Description private static class
MemberAttributeExtension.ForField.FieldAttributeVisitor
A 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
Constructors Modifier Constructor Description ForField()
Creates a field attribute extension that appends default values of annotations.ForField(AnnotationValueFilter.Factory annotationValueFilterFactory)
Creates a field attribute extension.protected
ForField(AnnotationValueFilter.Factory annotationValueFilterFactory, FieldAttributeAppender.Factory attributeAppenderFactory)
Creates a field attribute extension.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MemberAttributeExtension.ForField
annotate(java.lang.annotation.Annotation... annotation)
Appends the supplied annotations.MemberAttributeExtension.ForField
annotate(java.util.Collection<? extends AnnotationDescription> annotations)
Appends the supplied annotations.MemberAttributeExtension.ForField
annotate(java.util.List<? extends java.lang.annotation.Annotation> annotations)
Appends the supplied annotations.MemberAttributeExtension.ForField
annotate(AnnotationDescription... annotation)
Appends the supplied annotations.MemberAttributeExtension.ForField
attribute(FieldAttributeAppender.Factory attributeAppenderFactory)
Appends the supplied attribute appender factory.AsmVisitorWrapper
on(ElementMatcher<? super FieldDescription.InDefinedShape> matcher)
Applies this attribute extension on any field that matches the supplied matcher.org.objectweb.asm.FieldVisitor
wrap(TypeDescription instrumentedType, FieldDescription.InDefinedShape fieldDescription, org.objectweb.asm.FieldVisitor fieldVisitor)
Wraps a field visitor.
-
-
-
Constructor Detail
-
ForField
public ForField()
Creates a field attribute extension that appends default values of annotations.
-
ForField
public ForField(AnnotationValueFilter.Factory annotationValueFilterFactory)
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 Detail
-
annotate
public MemberAttributeExtension.ForField annotate(java.lang.annotation.Annotation... annotation)
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(java.util.List<? extends java.lang.annotation.Annotation> 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.
-
annotate
public MemberAttributeExtension.ForField annotate(AnnotationDescription... annotation)
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(java.util.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:
wrap
in 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
public AsmVisitorWrapper on(ElementMatcher<? super FieldDescription.InDefinedShape> matcher)
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.
-
-