public static enum AgentBuilder.InitializationStrategy.SelfInjection extends Enum<AgentBuilder.InitializationStrategy.SelfInjection> implements AgentBuilder.InitializationStrategy, Implementation, ByteCodeAppender
Modifier and Type | Class and Description |
---|---|
static class |
AgentBuilder.InitializationStrategy.SelfInjection.Nexus
This nexus is a global dispatcher for initializing classes with
LoadedTypeInitializer s. |
AgentBuilder.InitializationStrategy.NoOp, AgentBuilder.InitializationStrategy.SelfInjection
Implementation.Composable, Implementation.Compound, Implementation.Context, Implementation.Simple, Implementation.SpecialMethodInvocation, Implementation.Target
ByteCodeAppender.Compound, ByteCodeAppender.Simple, ByteCodeAppender.Size
Enum Constant and Description |
---|
INSTANCE
The singleton instance.
|
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.
|
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() |
static AgentBuilder.InitializationStrategy.SelfInjection |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static AgentBuilder.InitializationStrategy.SelfInjection[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final AgentBuilder.InitializationStrategy.SelfInjection INSTANCE
public static AgentBuilder.InitializationStrategy.SelfInjection[] values()
for (AgentBuilder.InitializationStrategy.SelfInjection c : AgentBuilder.InitializationStrategy.SelfInjection.values()) System.out.println(c);
public static AgentBuilder.InitializationStrategy.SelfInjection valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic DynamicType.Builder<?> apply(DynamicType.Builder<?> builder)
AgentBuilder.InitializationStrategy
apply
in interface AgentBuilder.InitializationStrategy
builder
- The builder which should implement the initialization strategy.builder
with the initialization strategy applied.public void initialize(Class<?> type, LoadedTypeInitializer loadedTypeInitializer)
AgentBuilder.InitializationStrategy
initialize
in interface AgentBuilder.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.InitializationStrategy
register
in interface AgentBuilder.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.public String toString()
toString
in class Enum<AgentBuilder.InitializationStrategy.SelfInjection>
Copyright © 2014–2015. All rights reserved.