Package net.bytebuddy.implementation
Class FieldAccessor.ForSetter.OfReferenceValue
- java.lang.Object
-
- net.bytebuddy.implementation.FieldAccessor
-
- net.bytebuddy.implementation.FieldAccessor.ForSetter<FieldDescription.InDefinedShape>
-
- net.bytebuddy.implementation.FieldAccessor.ForSetter.OfReferenceValue
-
- All Implemented Interfaces:
InstrumentedType.Prepareable,Implementation,Implementation.Composable
- Enclosing class:
- FieldAccessor.ForSetter<T>
@Enhance protected static class FieldAccessor.ForSetter.OfReferenceValue extends FieldAccessor.ForSetter<FieldDescription.InDefinedShape>
An instrumentation that sets a field to a reference value that is stored in a static field of the instrumented type.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.implementation.FieldAccessor.ForSetter
FieldAccessor.ForSetter.Appender, FieldAccessor.ForSetter.OfConstantValue, FieldAccessor.ForSetter.OfDefaultValue, FieldAccessor.ForSetter.OfFieldValue, FieldAccessor.ForSetter.OfParameterValue, FieldAccessor.ForSetter.OfReferenceValue, FieldAccessor.ForSetter.TerminationHandler
-
Nested classes/interfaces inherited from class net.bytebuddy.implementation.FieldAccessor
FieldAccessor.AssignerConfigurable, FieldAccessor.FieldLocation, FieldAccessor.FieldNameExtractor, FieldAccessor.ForImplicitProperty, FieldAccessor.ForSetter<T>, FieldAccessor.OwnerTypeLocatable, FieldAccessor.PropertyConfigurable
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.Implementation
Implementation.Composable, Implementation.Compound, Implementation.Context, Implementation.Simple, Implementation.SpecialMethodInvocation, Implementation.Target
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringnameThe name of the field to store the reference in.protected static java.lang.StringPREFIXThe prefix used for implicitly named cached fields.private java.lang.ObjectvalueThe value to store.-
Fields inherited from class net.bytebuddy.implementation.FieldAccessor
assigner, fieldLocation, typing
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedOfReferenceValue(FieldAccessor.FieldLocation fieldLocation, Assigner assigner, Assigner.Typing typing, FieldAccessor.ForSetter.TerminationHandler terminationHandler, java.lang.Object value, java.lang.String name)Creates a setter instrumentation for setting a value stored in a static field of the instrumented type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImplementationandThen(Implementation implementation)Appends the supplied implementation to this implementation.Implementation.ComposableandThen(Implementation.Composable implementation)Appends the supplied composable implementation to this implementation.protected FieldDescription.InDefinedShapeinitialize(TypeDescription instrumentedType)Initializes a value to be used during method instrumentation.InstrumentedTypeprepare(InstrumentedType instrumentedType)Prepares a given instrumented type.protected StackManipulationresolve(FieldDescription.InDefinedShape target, FieldDescription fieldDescription, TypeDescription instrumentedType, MethodDescription instrumentedMethod)Resolves the stack manipulation to load the value being set.-
Methods inherited from class net.bytebuddy.implementation.FieldAccessor.ForSetter
appender
-
Methods inherited from class net.bytebuddy.implementation.FieldAccessor
of, of, of, ofBeanProperty, ofField
-
-
-
-
Field Detail
-
PREFIX
protected static final java.lang.String PREFIX
The prefix used for implicitly named cached fields.- See Also:
- Constant Field Values
-
value
private final java.lang.Object value
The value to store.
-
name
private final java.lang.String name
The name of the field to store the reference in.
-
-
Constructor Detail
-
OfReferenceValue
protected OfReferenceValue(FieldAccessor.FieldLocation fieldLocation, Assigner assigner, Assigner.Typing typing, FieldAccessor.ForSetter.TerminationHandler terminationHandler, java.lang.Object value, java.lang.String name)
Creates a setter instrumentation for setting a value stored in a static field of the instrumented type.- Parameters:
fieldLocation- The field's location.assigner- The assigner to use.typing- Indicates if dynamic type castings should be attempted for incompatible assignments.terminationHandler- The termination handler to apply.value- The value to store.name- The name of the field to store the reference in.
-
-
Method Detail
-
prepare
public InstrumentedType prepare(InstrumentedType instrumentedType)
Prepares a given instrumented type.- Parameters:
instrumentedType- The instrumented type in its current form.- Returns:
- The prepared instrumented type.
-
initialize
protected FieldDescription.InDefinedShape initialize(TypeDescription instrumentedType)
Initializes a value to be used during method instrumentation.- Specified by:
initializein classFieldAccessor.ForSetter<FieldDescription.InDefinedShape>- Parameters:
instrumentedType- The instrumented type.- Returns:
- The initialized value.
-
resolve
protected StackManipulation resolve(FieldDescription.InDefinedShape target, FieldDescription fieldDescription, TypeDescription instrumentedType, MethodDescription instrumentedMethod)
Resolves the stack manipulation to load the value being set.- Specified by:
resolvein classFieldAccessor.ForSetter<FieldDescription.InDefinedShape>- Parameters:
target- The method that was initialized for the instrumented type.fieldDescription- The field to set the value for.instrumentedType- The instrumented type.instrumentedMethod- The instrumented method.- Returns:
- The stack manipulation to apply.
-
andThen
public Implementation andThen(Implementation implementation)
Appends the supplied implementation to this implementation.- Parameters:
implementation- The subsequent implementation.- Returns:
- An implementation that combines this implementation with the provided one.
-
andThen
public Implementation.Composable andThen(Implementation.Composable implementation)
Appends the supplied composable implementation to this implementation.- Parameters:
implementation- The subsequent composable implementation.- Returns:
- A composable implementation that combines this implementation with the provided one.
-
-