Package net.bytebuddy.implementation
Class InvocationHandlerAdapter.ForField
- java.lang.Object
-
- net.bytebuddy.implementation.InvocationHandlerAdapter
-
- net.bytebuddy.implementation.InvocationHandlerAdapter.ForField
-
- All Implemented Interfaces:
InstrumentedType.Prepareable,Implementation,InvocationHandlerAdapter.AssignerConfigurable
- Enclosing class:
- InvocationHandlerAdapter
protected static class InvocationHandlerAdapter.ForField extends InvocationHandlerAdapter implements InvocationHandlerAdapter.AssignerConfigurable
An implementation of anInvocationHandlerAdapterthat delegates method invocations to an adapter that is stored in an instance field.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classInvocationHandlerAdapter.ForField.AppenderAn appender for implementing theInvocationHandlerAdapter.ForField.-
Nested classes/interfaces inherited from class net.bytebuddy.implementation.InvocationHandlerAdapter
InvocationHandlerAdapter.AssignerConfigurable, InvocationHandlerAdapter.ForField, InvocationHandlerAdapter.ForInstance
-
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 inherited from class net.bytebuddy.implementation.InvocationHandlerAdapter
assigner, cacheMethods, CACHING, fieldName
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedForField(java.lang.String fieldName, boolean cacheMethods, Assigner assigner, FieldLocator.Factory fieldLocatorFactory)Creates a new invocation handler adapter that loads its value from a field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteCodeAppenderappender(Implementation.Target implementationTarget)Creates a byte code appender that determines the implementation of the instrumented type's methods.InstrumentedTypeprepare(InstrumentedType instrumentedType)Prepares a given instrumented type.ImplementationwithAssigner(Assigner assigner)Configures an assigner to use with this invocation handler adapter.InvocationHandlerAdapter.AssignerConfigurablewithoutMethodCache()By default, anyMethodinstance that is handed over to anInvocationHandleris cached in a static field.
-
-
-
Constructor Detail
-
ForField
protected ForField(java.lang.String fieldName, boolean cacheMethods, Assigner assigner, FieldLocator.Factory fieldLocatorFactory)Creates a new invocation handler adapter that loads its value from a field.- Parameters:
fieldName- The name of the field.cacheMethods- Determines if theMethodinstances that are handed to the intercepted methods are cached instaticfields.assigner- The assigner to apply when defining this implementation.fieldLocatorFactory- The field locator factory to use.
-
-
Method Detail
-
withoutMethodCache
public InvocationHandlerAdapter.AssignerConfigurable withoutMethodCache()
Description copied from class:InvocationHandlerAdapterBy default, anyMethodinstance that is handed over to anInvocationHandleris cached in a static field. By invoking this method, this feature can be disabled.- Specified by:
withoutMethodCachein classInvocationHandlerAdapter- Returns:
- A similar invocation handler adapter that applies caching.
-
withAssigner
public Implementation withAssigner(Assigner assigner)
Description copied from interface:InvocationHandlerAdapter.AssignerConfigurableConfigures an assigner to use with this invocation handler adapter.- Specified by:
withAssignerin interfaceInvocationHandlerAdapter.AssignerConfigurable- Parameters:
assigner- The assigner to apply when defining this implementation.- Returns:
- This instrumentation with the given
assignerconfigured.
-
prepare
public InstrumentedType prepare(InstrumentedType instrumentedType)
Description copied from interface:InstrumentedType.PrepareablePrepares a given instrumented type.- Specified by:
preparein interfaceInstrumentedType.Prepareable- Parameters:
instrumentedType- The instrumented type in its current form.- Returns:
- The prepared instrumented type.
-
appender
public ByteCodeAppender appender(Implementation.Target implementationTarget)
Description copied from interface:ImplementationCreates a byte code appender that determines the implementation of the instrumented type's methods.- Specified by:
appenderin interfaceImplementation- Parameters:
implementationTarget- The target of the current implementation.- Returns:
- A byte code appender for implementing methods delegated to this implementation. This byte code appender
is also responsible for handling methods that were added by this implementation on the call to
InstrumentedType.Prepareable.prepare(InstrumentedType).
-
-