public static class AgentBuilder.Default.InitializationStrategy.SelfInjection extends Object implements AgentBuilder.Default.InitializationStrategy, Implementation, ByteCodeAppender
Modifier and Type | Class and Description |
---|---|
static class |
AgentBuilder.Default.InitializationStrategy.SelfInjection.Nexus
This nexus is a global dispatcher for initializing classes with
LoadedTypeInitializer s. |
AgentBuilder.Default.InitializationStrategy.NoOp, AgentBuilder.Default.InitializationStrategy.SelfInjection
Implementation.Compound, Implementation.Context, Implementation.Simple, Implementation.SpecialMethodInvocation, Implementation.Target
ByteCodeAppender.Compound, ByteCodeAppender.Simple, ByteCodeAppender.Size
Constructor and Description |
---|
SelfInjection()
Creates a new self injection strategy.
|
Modifier and Type | Method and Description |
---|---|
ByteCodeAppender |
appender(Implementation.Target implementationTarget)
Creates a byte code appender that determines the implementation of the instrumented type's methods.
|
DynamicType.Builder<?> |
apply(DynamicType.Builder<?> builder)
Transforms the instrumented type to implement an appropriate initialization strategy.
|
ByteCodeAppender.Size |
apply(MethodVisitor methodVisitor,
Implementation.Context implementationContext,
MethodDescription instrumentedMethod)
Applies this byte code appender to a type creation process.
|
boolean |
equals(Object other) |
int |
hashCode() |
void |
initialize(Class<?> type,
LoadedTypeInitializer loadedTypeInitializer)
Determines if and how a loaded type initializer is to be applied to a loaded type.
|
InstrumentedType |
prepare(InstrumentedType instrumentedType)
During the preparation phase of an implementation, implementations are eligible to adding fields or methods
to the currently instrumented type.
|
void |
register(String name,
ClassLoader classLoader,
LoadedTypeInitializer loadedTypeInitializer)
Registers a loaded type initializer for a type name and class loader pair.
|
String |
toString() |
public DynamicType.Builder<?> apply(DynamicType.Builder<?> builder)
AgentBuilder.Default.InitializationStrategy
apply
in interface AgentBuilder.Default.InitializationStrategy
builder
- The builder which should implement the initialization strategy.builder
with the initialization strategy applied.public void initialize(Class<?> type, LoadedTypeInitializer loadedTypeInitializer)
AgentBuilder.Default.InitializationStrategy
initialize
in interface AgentBuilder.Default.InitializationStrategy
type
- The loaded type.loadedTypeInitializer
- The type
's loaded type initializer.public InstrumentedType prepare(InstrumentedType instrumentedType)
Implementation
ByteCodeAppender
that is emitted
on the call to
Implementation.appender(Implementation.Target)
call. On this method call, loaded type initializers can also be added to the instrumented type.prepare
in interface Implementation
instrumentedType
- The instrumented type that is the basis of the ongoing instrumentation.public ByteCodeAppender appender(Implementation.Target implementationTarget)
Implementation
appender
in interface Implementation
implementationTarget
- The target of the current implementation.Implementation.prepare(InstrumentedType)
.public ByteCodeAppender.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)
ByteCodeAppender
apply
in interface ByteCodeAppender
methodVisitor
- The method visitor to which the byte code appender writes its code to.implementationContext
- The implementation context of the current type creation process.instrumentedMethod
- The method that is the target of the instrumentation.public void register(String name, ClassLoader classLoader, LoadedTypeInitializer loadedTypeInitializer)
AgentBuilder.Default.InitializationStrategy
register
in interface AgentBuilder.Default.InitializationStrategy
name
- The name of the type for which the loaded type initializer is to be
registered.classLoader
- The class loader of the instrumented type. Might be null
if
this class loader represents the bootstrap class loader.loadedTypeInitializer
- The loaded type initializer that is being registered.Copyright © 2014–2015. All rights reserved.