Class Transformer.ForField

java.lang.Object
net.bytebuddy.dynamic.Transformer.ForField
All Implemented Interfaces:
Transformer<FieldDescription>
Enclosing interface:
Transformer<T>

@Enhance public static class Transformer.ForField extends Object implements Transformer<FieldDescription>
A transformer for a field that delegates to another transformer that transforms a FieldDescription.Token.
  • Field Details

  • Constructor Details

    • ForField

      public ForField(Transformer<FieldDescription.Token> transformer)
      Creates a new simple field transformer.
      Parameters:
      transformer - The token transformer to apply to a transformed field.
  • Method Details

    • withModifiers

      public static Transformer<FieldDescription> withModifiers(ModifierContributor.ForField... modifierContributor)
      Creates a field transformer that patches the transformed field by the given modifier contributors.
      Parameters:
      modifierContributor - The modifier contributors to apply.
      Returns:
      A suitable field transformer.
    • withModifiers

      public static Transformer<FieldDescription> withModifiers(List<? extends ModifierContributor.ForField> modifierContributors)
      Creates a field transformer that patches the transformed field by the given modifier contributors.
      Parameters:
      modifierContributors - The modifier contributors to apply.
      Returns:
      A suitable field transformer.
    • transform

      public FieldDescription transform(TypeDescription instrumentedType, FieldDescription fieldDescription)
      Transforms the supplied target.
      Specified by:
      transform in interface Transformer<FieldDescription>
      Parameters:
      instrumentedType - The instrumented type that declares the target being transformed.
      fieldDescription - The target entity that is being transformed.
      Returns:
      The transformed instance.