protected class AgentBuilder.Default.Matched extends Object implements AgentBuilder.Identified.Extendable
AgentBuilder.Default
after supplying
a AgentBuilder.RawMatcher
such that one or several
AgentBuilder.Transformer
s can be supplied.AgentBuilder.BinaryLocator, AgentBuilder.Default, AgentBuilder.Identified, AgentBuilder.Listener, AgentBuilder.RawMatcher, AgentBuilder.Transformer
AgentBuilder.Identified.Extendable
Modifier | Constructor and Description |
---|---|
protected |
Matched(AgentBuilder.RawMatcher rawMatcher,
AgentBuilder.Transformer transformer)
Creates a new matched 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
LoadedTypeInitializer s that are registered
with a DynamicType . |
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. |
protected AgentBuilder |
materialize()
Materializes the currently described
AgentBuilder.Default.Transformation . |
AgentBuilder.Identified |
rebase(AgentBuilder.RawMatcher matcher)
Matches a type being loaded in order to apply the supplied
AgentBuilder.Transformer s before loading this type. |
AgentBuilder.Identified |
rebase(ElementMatcher<? super TypeDescription> typeMatcher)
Matches a type being loaded in order to apply the supplied
AgentBuilder.Transformer s 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.Transformer s before loading this type. |
String |
toString() |
AgentBuilder.Identified.Extendable |
transform(AgentBuilder.Transformer transformer)
Applies the given transformer for the already supplied matcher.
|
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 Matched(AgentBuilder.RawMatcher rawMatcher, AgentBuilder.Transformer transformer)
rawMatcher
- The supplied raw matcher.transformer
- The supplied transformer.public AgentBuilder.Identified.Extendable transform(AgentBuilder.Transformer transformer)
AgentBuilder.Identified
transform
in interface AgentBuilder.Identified
transformer
- The transformer to apply.public AgentBuilder.Identified rebase(AgentBuilder.RawMatcher matcher)
AgentBuilder
AgentBuilder.Transformer
s before loading this type.rebase
in interface AgentBuilder
matcher
- A matcher that decides if the entailed
AgentBuilder.Transformer
s should be applied for a type that
is being loaded.AgentBuilder.Transformer
s to be applied when the given matcher
indicates a match.public AgentBuilder.Identified rebase(ElementMatcher<? super TypeDescription> typeMatcher)
AgentBuilder
AgentBuilder.Transformer
s before loading this type.rebase
in interface AgentBuilder
typeMatcher
- An ElementMatcher
that is applied on the type being loaded that
decides if the entailed
AgentBuilder.Transformer
s should be applied for that
type.AgentBuilder.Transformer
s to be applied when the given typeMatcher
indicates a match.public AgentBuilder.Identified rebase(ElementMatcher<? super TypeDescription> typeMatcher, ElementMatcher<? super ClassLoader> classLoaderMatcher)
AgentBuilder
AgentBuilder.Transformer
s before loading this type.rebase
in interface AgentBuilder
typeMatcher
- An ElementMatcher
that is applied on the type being
loaded that decides if the entailed
AgentBuilder.Transformer
s 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.Transformer
s to be applied when both the given
typeMatcher
and classLoaderMatcher
indicate a match.public AgentBuilder withByteBuddy(ByteBuddy byteBuddy)
AgentBuilder
ByteBuddy
instance to be used by the created agent.withByteBuddy
in interface AgentBuilder
byteBuddy
- The Byte Buddy instance to be used.byteBuddy
instance.public AgentBuilder withListener(AgentBuilder.Listener listener)
AgentBuilder
AgentBuilder.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 AgentBuilder
listener
- The listener to be notified.public AgentBuilder withBinaryLocator(AgentBuilder.BinaryLocator binaryLocator)
AgentBuilder
withBinaryLocator
in interface AgentBuilder
binaryLocator
- The binary locator to use.public AgentBuilder withNativeMethodPrefix(String prefix)
AgentBuilder
Instrumentation
.withNativeMethodPrefix
in interface AgentBuilder
prefix
- The prefix to be used.public AgentBuilder disableSelfInitialization()
AgentBuilder
Disables the execution of any LoadedTypeInitializer
s 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 LoadedTypeInitializer
s might be
more appropriate.
disableSelfInitialization
in interface AgentBuilder
public AgentBuilder allowRetransformation()
AgentBuilder
allowRetransformation
in interface AgentBuilder
public ClassFileTransformer makeRaw()
AgentBuilder
ClassFileTransformer
that implements the configuration of this
agent builder.makeRaw
in interface AgentBuilder
public ClassFileTransformer installOn(Instrumentation instrumentation)
AgentBuilder
ClassFileTransformer
that implements the configuration of
this agent builder with a given Instrumentation
.installOn
in interface AgentBuilder
instrumentation
- The instrumentation on which this agent builder's configuration is to be installed.public ClassFileTransformer installOnByteBuddyAgent()
AgentBuilder
ClassFileTransformer
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 AgentBuilder
protected AgentBuilder materialize()
AgentBuilder.Default.Transformation
.Copyright © 2014. All rights reserved.