public static class AgentBuilder.Default.InitializationStrategy.SelfInjection extends Object implements AgentBuilder.Default.InitializationStrategy, Instrumentation, 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
Instrumentation.Compound, Instrumentation.Context, Instrumentation.ForAbstractMethod, Instrumentation.Simple, Instrumentation.SpecialMethodInvocation, Instrumentation.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(Instrumentation.Target instrumentationTarget)
Creates a byte code appender that determines the implementation of the instrumented type's methods.
|
boolean |
appendsCode()
Determines if this byte code appender offers an (possibly empty) implementation of a method.
|
DynamicType.Builder<?> |
apply(DynamicType.Builder<?> builder)
Transforms the instrumented type to implement an appropriate initialization strategy.
|
ByteCodeAppender.Size |
apply(org.objectweb.asm.MethodVisitor methodVisitor,
Instrumentation.Context instrumentationContext,
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 instrumentation, 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)
Instrumentation
ByteCodeAppender
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.prepare
in interface Instrumentation
instrumentedType
- The instrumented type that is the basis of the ongoing instrumentation.public ByteCodeAppender appender(Instrumentation.Target instrumentationTarget)
Instrumentation
appender
in interface Instrumentation
instrumentationTarget
- The target of the current instrumentation.Instrumentation.prepare(net.bytebuddy.instrumentation.type.InstrumentedType)
.public boolean appendsCode()
ByteCodeAppender
appendsCode
in interface ByteCodeAppender
true
if this byte code appender requires this method to be implemented or false
if this
appender describes an abstract method.public ByteCodeAppender.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Instrumentation.Context instrumentationContext, MethodDescription instrumentedMethod)
ByteCodeAppender
apply
in interface ByteCodeAppender
methodVisitor
- The method visitor to which the byte code appender writes its code to.instrumentationContext
- The instrumentation 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.