Package net.bytebuddy.agent.builder
Enum AgentBuilder.PatchMode
- java.lang.Object
-
- java.lang.Enum<AgentBuilder.PatchMode>
-
- net.bytebuddy.agent.builder.AgentBuilder.PatchMode
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<AgentBuilder.PatchMode>
- Enclosing interface:
- AgentBuilder
public static enum AgentBuilder.PatchMode extends java.lang.Enum<AgentBuilder.PatchMode>
Determines how patching aResettableClassFileTransformer
resolves the transformer exchange.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
AgentBuilder.PatchMode.Handler
A handler to allow for callbacks prior and after registering aClassFileTransformer
.
-
Enum Constant Summary
Enum Constants Enum Constant Description GAP
Allows for a short period where neither class file transformer is registered.OVERLAP
Allows for a short period where both class file transformer are registered.SUBSTITUTE
Requires aResettableClassFileTransformer.Substitutable
class file transformer which can exchange the actual class file transformer without any overlaps or changes in order.
-
Constructor Summary
Constructors Modifier Constructor Description private
PatchMode()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static AgentBuilder.PatchMode
of(ResettableClassFileTransformer classFileTransformer)
Resolves a default patch mode for a givenResettableClassFileTransformer
.protected abstract AgentBuilder.PatchMode.Handler
toHandler(ResettableClassFileTransformer classFileTransformer)
Resolves this strategy to a handler.static AgentBuilder.PatchMode
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static AgentBuilder.PatchMode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
GAP
public static final AgentBuilder.PatchMode GAP
Allows for a short period where neither class file transformer is registered. This might allow for classes to execute without instrumentation if they are loaded in a short moment where neither transformer is registered. In some rare cases, this might also cause that these classes are not instrumented as a result of the patching.
-
OVERLAP
public static final AgentBuilder.PatchMode OVERLAP
Allows for a short period where both class file transformer are registered. This might allow for classes to apply both instrumentations. In some rare cases, this might also cause that both instrumentations are permanently applied.
-
SUBSTITUTE
public static final AgentBuilder.PatchMode SUBSTITUTE
Requires aResettableClassFileTransformer.Substitutable
class file transformer which can exchange the actual class file transformer without any overlaps or changes in order. Normally, this can be achieved easily by addingAgentBuilder.TransformerDecorator.ForSubstitution
as a last decorator prior to installation.
-
-
Method Detail
-
values
public static AgentBuilder.PatchMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (AgentBuilder.PatchMode c : AgentBuilder.PatchMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AgentBuilder.PatchMode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
of
protected static AgentBuilder.PatchMode of(ResettableClassFileTransformer classFileTransformer)
Resolves a default patch mode for a givenResettableClassFileTransformer
.- Parameters:
classFileTransformer
- The class file transformer to consider.- Returns:
- A meaningful default patch mode.
-
toHandler
protected abstract AgentBuilder.PatchMode.Handler toHandler(ResettableClassFileTransformer classFileTransformer)
Resolves this strategy to a handler.- Parameters:
classFileTransformer
- The class file transformer to deregister.- Returns:
- The handler to apply.
-
-