protected static class InvocationHandlerAdapter.ForStaticDelegation extends InvocationHandlerAdapter
InvocationHandlerAdapter that delegates method
invocations to an adapter that is stored in a static field.| Modifier and Type | Class and Description |
|---|---|
protected class |
InvocationHandlerAdapter.ForStaticDelegation.Appender
An appender for implementing the
InvocationHandlerAdapter.ForStaticDelegation. |
InvocationHandlerAdapter.ForInstanceDelegation, InvocationHandlerAdapter.ForStaticDelegationInstrumentation.Compound, Instrumentation.Context, Instrumentation.ForAbstractMethod, Instrumentation.Simple, Instrumentation.SpecialMethodInvocation, Instrumentation.Target| Modifier and Type | Field and Description |
|---|---|
protected InvocationHandler |
invocationHandler
The invocation handler to which method interceptions are to be delegated.
|
assigner, cacheMethods, fieldName| Modifier and Type | Method and Description |
|---|---|
ByteCodeAppender |
appender(Instrumentation.Target instrumentationTarget)
Creates a byte code appender that determines the implementation of the instrumented type's methods.
|
boolean |
equals(Object other) |
int |
hashCode() |
InstrumentedType |
prepare(InstrumentedType instrumentedType)
During the preparation phase of an instrumentation, implementations are eligible to adding fields or methods
to the currently instrumented type.
|
String |
toString() |
Instrumentation |
withMethodCache()
By default, any
Method instance that is handed over to an
InvocationHandler is created on each invocation of the method. |
apply, of, of, toInstanceFieldprotected final InvocationHandler invocationHandler
public Instrumentation withMethodCache()
InvocationHandlerAdapterMethod instance that is handed over to an
InvocationHandler is created on each invocation of the method.
Method look-ups are normally cached by its defining Class what
makes a repeated look-up of a method little expensive. However, because Method
instances are mutable by their AccessibleObject contact, any looked-up instance
needs to be copied by its defining Class before exposing it. This can cause performance
deficits when a method is for example called repeatedly in a loop. By enabling the method cache, this
performance penalty can be avoided by caching a single Method instance for
any intercepted method as a static field in the instrumented type.withMethodCache in class InvocationHandlerAdapterMethod instance
in form of a static field.public InstrumentedType prepare(InstrumentedType instrumentedType)
InstrumentationByteCodeAppender that is emitted
on the call to
Instrumentation.appender(net.bytebuddy.instrumentation.Instrumentation.Target)
call. On this method call, loaded type initializers can also be added to the instrumented type.instrumentedType - The instrumented type that is the basis of the ongoing instrumentation.public ByteCodeAppender appender(Instrumentation.Target instrumentationTarget)
InstrumentationinstrumentationTarget - The target of the current instrumentation.Instrumentation.prepare(net.bytebuddy.instrumentation.type.InstrumentedType).public boolean equals(Object other)
equals in class InvocationHandlerAdapterpublic int hashCode()
hashCode in class InvocationHandlerAdapterCopyright © 2014. All rights reserved.