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 Object
implements Transformer<FieldDescription>
A transformer for a field that delegates to another transformer that transforms a
FieldDescription.Token
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A transformer for a field's modifiers.protected static class
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
FieldsModifier and TypeFieldDescriptionprivate final Transformer
<FieldDescription.Token> The token transformer to apply to a transformed field. -
Constructor Summary
ConstructorsConstructorDescriptionForField
(Transformer<FieldDescription.Token> transformer) Creates a new simple field transformer. -
Method Summary
Modifier and TypeMethodDescriptiontransform
(TypeDescription instrumentedType, FieldDescription fieldDescription) Transforms the supplied target.static Transformer
<FieldDescription> withModifiers
(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 Details
-
transformer
The token transformer to apply to a transformed field.
-
-
Constructor Details
-
ForField
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 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.
-