Package net.bytebuddy.dynamic
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 java.lang.Object implements Transformer<FieldDescription>
A transformer for a field that delegates to another transformer that transforms aFieldDescription.Token
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Transformer.ForField.FieldModifierTransformer
A transformer for a field's modifiers.protected static class
Transformer.ForField.TransformedField
An implementation of a transformed field.-
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.Transformer
Transformer.Compound<S>, Transformer.ForField, Transformer.ForMethod, Transformer.NoOp
-
-
Field Summary
Fields Modifier and Type Field Description private Transformer<FieldDescription.Token>
transformer
The token transformer to apply to a transformed field.
-
Constructor Summary
Constructors Constructor Description ForField(Transformer<FieldDescription.Token> transformer)
Creates a new simple field transformer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldDescription
transform(TypeDescription instrumentedType, FieldDescription fieldDescription)
Transforms the supplied target.static Transformer<FieldDescription>
withModifiers(java.util.List<? extends ModifierContributor.ForField> modifierContributors)
Creates a field transformer that patches the transformed field by the given modifier contributors.static Transformer<FieldDescription>
withModifiers(ModifierContributor.ForField... modifierContributor)
Creates a field transformer that patches the transformed field by the given modifier contributors.
-
-
-
Field Detail
-
transformer
private final Transformer<FieldDescription.Token> transformer
The token transformer to apply to a transformed field.
-
-
Constructor Detail
-
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 Detail
-
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(java.util.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 interfaceTransformer<FieldDescription>
- Parameters:
instrumentedType
- The instrumented type that declares the target being transformed.fieldDescription
- The target entity that is being transformed.- Returns:
- The transformed instance.
-
-