public static class AgentBuilder.Default extends Object implements AgentBuilder
AgentBuilder.| Modifier and Type | Class and Description |
|---|---|
protected static interface |
AgentBuilder.Default.BootstrapInjectionStrategy
An injection strategy for injecting classes into the bootstrap class loader.
|
protected class |
AgentBuilder.Default.ExecutingTransformer
A
ClassFileTransformer that implements the enclosing agent builder's
configuration. |
static interface |
AgentBuilder.Default.InitializationStrategy
An initialization strategy which determines the handling of
LoadedTypeInitializers. |
protected class |
AgentBuilder.Default.Matched
A helper class that describes a
AgentBuilder.Default after supplying
a AgentBuilder.RawMatcher such that one or several
AgentBuilder.Transformers can be supplied. |
protected static class |
AgentBuilder.Default.Transformation
A registered transformation as a combination of a
AgentBuilder.RawMatcher and a
AgentBuilder.Transformer. |
AgentBuilder.BinaryLocator, AgentBuilder.Default, AgentBuilder.Identified, AgentBuilder.Listener, AgentBuilder.RawMatcher, AgentBuilder.Transformer| Modifier and Type | Field and Description |
|---|---|
protected static String |
NO_NATIVE_PREFIX
The string value that is used to indicate that no name prefix for native methods should be used.
|
| Modifier | Constructor and Description |
|---|---|
|
Default()
Creates a new default agent builder that uses a default
ByteBuddy instance for
creating classes. |
|
Default(ByteBuddy byteBuddy)
Creates a new default agent builder.
|
protected |
Default(ByteBuddy byteBuddy,
AgentBuilder.BinaryLocator binaryLocator,
AgentBuilder.Listener listener,
String nativeMethodPrefix,
boolean disableSelfInitialization,
boolean retransformation,
AgentBuilder.Default.BootstrapInjectionStrategy bootstrapInjectionStrategy,
List<AgentBuilder.Default.Transformation> entries)
Creates a new default agent builder.
|
| Modifier and Type | Method and Description |
|---|---|
AgentBuilder |
allowRetransformation()
Enables retransformation when this agent is installed.
|
AgentBuilder |
disableSelfInitialization()
Disables the execution of any
LoadedTypeInitializers that are registered
with a DynamicType. |
AgentBuilder |
enableBootstrapInjection(File folder,
Instrumentation instrumentation)
Enables class injection of auxiliary classes into the bootstrap class loader.
|
boolean |
equals(Object other) |
int |
hashCode() |
ClassFileTransformer |
installOn(Instrumentation instrumentation)
Creates and installs a
ClassFileTransformer that implements the configuration of
this agent builder with a given Instrumentation. |
ClassFileTransformer |
installOnByteBuddyAgent()
Creates and installs a
ClassFileTransformer that implements the configuration of
this agent builder with the Byte Buddy-agent which must be installed prior to calling this method. |
ClassFileTransformer |
makeRaw()
Creates a
ClassFileTransformer that implements the configuration of this
agent builder. |
AgentBuilder.Identified |
rebase(AgentBuilder.RawMatcher matcher)
Matches a type being loaded in order to apply the supplied
AgentBuilder.Transformers before loading this type. |
AgentBuilder.Identified |
rebase(ElementMatcher<? super TypeDescription> typeMatcher)
Matches a type being loaded in order to apply the supplied
AgentBuilder.Transformers before loading this type. |
AgentBuilder.Identified |
rebase(ElementMatcher<? super TypeDescription> typeMatcher,
ElementMatcher<? super ClassLoader> classLoaderMatcher)
Matches a type being loaded in order to apply the supplied
AgentBuilder.Transformers before loading this type. |
String |
toString() |
AgentBuilder |
withBinaryLocator(AgentBuilder.BinaryLocator binaryLocator)
Defines the use of the given binary locator for locating binary data to given class names.
|
AgentBuilder |
withByteBuddy(ByteBuddy byteBuddy)
Defines the given
ByteBuddy instance to be used by the created agent. |
AgentBuilder |
withListener(AgentBuilder.Listener listener)
Defines the given
AgentBuilder.Listener to be notified by the created agent. |
AgentBuilder |
withNativeMethodPrefix(String prefix)
Enables the use of the given native method prefix for instrumented methods.
|
protected static final String NO_NATIVE_PREFIX
public Default()
ByteBuddy instance for
creating classes.public Default(ByteBuddy byteBuddy)
byteBuddy - The Byte Buddy instance to be used.protected Default(ByteBuddy byteBuddy, AgentBuilder.BinaryLocator binaryLocator, AgentBuilder.Listener listener, String nativeMethodPrefix, boolean disableSelfInitialization, boolean retransformation, AgentBuilder.Default.BootstrapInjectionStrategy bootstrapInjectionStrategy, List<AgentBuilder.Default.Transformation> entries)
byteBuddy - The Byte Buddy instance to be used.binaryLocator - The binary locator to use.listener - The listener to notify on transformations.nativeMethodPrefix - The native method prefix to use which might also represent
NO_NATIVE_PREFIX
to indicate that no prefix should be added but rather a random suffix.disableSelfInitialization - true if generated types should not create a callback inside their
type initializer in order to call their potential
LoadedTypeInitializer.retransformation - true if the generated
ClassFileTransformer should also apply
for retransformations.bootstrapInjectionStrategy - The injection strategy for injecting classes into the bootstrap class loader.entries - The list of transformation entries that are registered with this
agent builder.public AgentBuilder.Identified rebase(AgentBuilder.RawMatcher matcher)
AgentBuilderAgentBuilder.Transformers before loading this type.rebase in interface AgentBuildermatcher - A matcher that decides if the entailed
AgentBuilder.Transformers should be applied for a type that
is being loaded.AgentBuilder.Transformers to be applied when the given matcher
indicates a match.public AgentBuilder.Identified rebase(ElementMatcher<? super TypeDescription> typeMatcher)
AgentBuilderAgentBuilder.Transformers before loading this type.rebase in interface AgentBuildertypeMatcher - An ElementMatcher that is applied on the type being loaded that
decides if the entailed
AgentBuilder.Transformers should be applied for that
type.AgentBuilder.Transformers to be applied when the given typeMatcher
indicates a match.public AgentBuilder.Identified rebase(ElementMatcher<? super TypeDescription> typeMatcher, ElementMatcher<? super ClassLoader> classLoaderMatcher)
AgentBuilderAgentBuilder.Transformers before loading this type.rebase in interface AgentBuildertypeMatcher - An ElementMatcher that is applied on the type being
loaded that decides if the entailed
AgentBuilder.Transformers should be applied for
that type.classLoaderMatcher - An ElementMatcher that is applied to the
ClassLoader that is loading the type being loaded. This matcher
is always applied first where the type matcher is not applied in case that this
matcher does not indicate a match.AgentBuilder.Transformers to be applied when both the given
typeMatcher and classLoaderMatcher indicate a match.public AgentBuilder withByteBuddy(ByteBuddy byteBuddy)
AgentBuilderByteBuddy instance to be used by the created agent.withByteBuddy in interface AgentBuilderbyteBuddy - The Byte Buddy instance to be used.byteBuddy instance.public AgentBuilder withListener(AgentBuilder.Listener listener)
AgentBuilderAgentBuilder.Listener to be notified by the created agent.
The given listener is notified after any other listener that is already registered. If a listener is registered
twice, it is also notified twice.withListener in interface AgentBuilderlistener - The listener to be notified.public AgentBuilder withBinaryLocator(AgentBuilder.BinaryLocator binaryLocator)
AgentBuilderwithBinaryLocator in interface AgentBuilderbinaryLocator - The binary locator to use.public AgentBuilder withNativeMethodPrefix(String prefix)
AgentBuilderInstrumentation.withNativeMethodPrefix in interface AgentBuilderprefix - The prefix to be used.public AgentBuilder allowRetransformation()
AgentBuilderallowRetransformation in interface AgentBuilderpublic AgentBuilder disableSelfInitialization()
AgentBuilder
Disables the execution of any LoadedTypeInitializers that are registered
with a DynamicType. This might cause the dynamic type to malfunction if the
LoadedTypeInitializer are not executed elsewhere before an instrumented
type is put in use for the first time.
In order to execute a self initialization, Byte Buddy adds a call back into any dynamic type's type initializer.
This call back requires the injection of a call back dispatcher into the system class loader what might not
be a feasible solution on distributed applications where classes are shared among different JVMs where a
different strategy for executing LoadedTypeInitializers might be
more appropriate.
disableSelfInitialization in interface AgentBuilderpublic AgentBuilder enableBootstrapInjection(File folder, Instrumentation instrumentation)
AgentBuilderenableBootstrapInjection in interface AgentBuilderfolder - The folder in which jar files of the injected classes are to be stored.instrumentation - The instrumentation instance that is used for appending jar files to the
bootstrap class path.public ClassFileTransformer makeRaw()
AgentBuilderClassFileTransformer that implements the configuration of this
agent builder.makeRaw in interface AgentBuilderpublic ClassFileTransformer installOn(Instrumentation instrumentation)
AgentBuilderClassFileTransformer that implements the configuration of
this agent builder with a given Instrumentation.installOn in interface AgentBuilderinstrumentation - The instrumentation on which this agent builder's configuration is to be installed.public ClassFileTransformer installOnByteBuddyAgent()
AgentBuilderClassFileTransformer that implements the configuration of
this agent builder with the Byte Buddy-agent which must be installed prior to calling this method.installOnByteBuddyAgent in interface AgentBuilderCopyright © 2014–2015. All rights reserved.