Class 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.
  • Constructor Details

    • 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 Details

    • annotate

      public MemberAttributeExtension.ForField annotate(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(List<? extends 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

      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:
      wrap in interface AsmVisitorWrapper.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.