Interface ResettableClassFileTransformer
- All Superinterfaces:
ClassFileTransformer
- All Known Implementing Classes:
AgentBuilder.Default.ExecutingTransformer
,ResettableClassFileTransformer.AbstractBase
,ResettableClassFileTransformer.WithDelegation
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
An abstract base implementation of aResettableClassFileTransformer
.static class
Implements a resettable class file transformer that allows for the delegation of a transformation. -
Method Summary
Modifier and TypeMethodDescriptioniterator
(TypeDescription typeDescription, ClassLoader classLoader, JavaModule module, Class<?> classBeingRedefined, ProtectionDomain protectionDomain) Creates an iterator over the transformers that are applied for a given type.boolean
reset
(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled.boolean
reset
(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled.boolean
reset
(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled.boolean
reset
(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled.boolean
reset
(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled.boolean
reset
(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled.boolean
reset
(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled.boolean
reset
(Instrumentation instrumentation, ResettableClassFileTransformer classFileTransformer, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled.Methods inherited from interface java.lang.instrument.ClassFileTransformer
transform, transform
-
Method Details
-
iterator
Iterator<AgentBuilder.Transformer> iterator(TypeDescription typeDescription, @MaybeNull ClassLoader classLoader, @MaybeNull JavaModule module, @MaybeNull Class<?> classBeingRedefined, ProtectionDomain protectionDomain) Creates an iterator over the transformers that are applied for a given type.- Parameters:
typeDescription
- A description of a type.classLoader
- The type's class loader ornull
if the boot loader.module
- The type's module ornull
if the module system is not supported by the current VM.classBeingRedefined
- The class being redefined ornull
if the type is not yet loaded.protectionDomain
- The type's protection domain.- Returns:
- An iterator over the transformers that are applied by this class file transformer if the given type is discovered.
-
reset
boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled. If it is not enabled, only the
AgentBuilder.InstallationListener
is informed about the resetting without undoing any code changes.Note: A reset class file transformer should not be reinstalled. Instead, the
AgentBuilder
which built the transformer should be asked to install a new transformer.Important: Most JVMs do not support changes of a class's structure after a class was already loaded. Therefore, it is typically required that this class file transformer was built while enabling
AgentBuilder.disableClassFormatChanges()
.- Parameters:
instrumentation
- The instrumentation instance from which to deregister the transformer.redefinitionStrategy
- The redefinition to apply.- Returns:
true
if a reset was applied and this transformer was not previously removed.
-
reset
boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled. If it is not enabled, only the
AgentBuilder.InstallationListener
is informed about the resetting without undoing any code changes.Note: A reset class file transformer should not be reinstalled. Instead, the
AgentBuilder
which built the transformer should be asked to install a new transformer.Important: Most JVMs do not support changes of a class's structure after a class was already loaded. Therefore, it is typically required that this class file transformer was built while enabling
AgentBuilder.disableClassFormatChanges()
.- Parameters:
instrumentation
- The instrumentation instance from which to deregister the transformer.redefinitionStrategy
- The redefinition to apply.redefinitionBatchAllocator
- The batch allocator to use.- Returns:
true
if a reset was applied and this transformer was not previously removed.
-
reset
boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled. If it is not enabled, only the
AgentBuilder.InstallationListener
is informed about the resetting without undoing any code changes.Note: A reset class file transformer should not be reinstalled. Instead, the
AgentBuilder
which built the transformer should be asked to install a new transformer.Important: Most JVMs do not support changes of a class's structure after a class was already loaded. Therefore, it is typically required that this class file transformer was built while enabling
AgentBuilder.disableClassFormatChanges()
.- Parameters:
instrumentation
- The instrumentation instance from which to deregister the transformer.redefinitionStrategy
- The redefinition to apply.redefinitionDiscoveryStrategy
- The discovery strategy for the types to reset.- Returns:
true
if a reset was applied and this transformer was not previously removed.
-
reset
boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled. If it is not enabled, only the
AgentBuilder.InstallationListener
is informed about the resetting without undoing any code changes.Note: A reset class file transformer should not be reinstalled. Instead, the
AgentBuilder
which built the transformer should be asked to install a new transformer.Important: Most JVMs do not support changes of a class's structure after a class was already loaded. Therefore, it is typically required that this class file transformer was built while enabling
AgentBuilder.disableClassFormatChanges()
.- Parameters:
instrumentation
- The instrumentation instance from which to deregister the transformer.redefinitionStrategy
- The redefinition to apply.redefinitionDiscoveryStrategy
- The discovery strategy for the types to reset.redefinitionBatchAllocator
- The batch allocator to use.- Returns:
true
if a reset was applied and this transformer was not previously removed.
-
reset
boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled. If it is not enabled, only the
AgentBuilder.InstallationListener
is informed about the resetting without undoing any code changes.Note: A reset class file transformer should not be reinstalled. Instead, the
AgentBuilder
which built the transformer should be asked to install a new transformer.Important: Most JVMs do not support changes of a class's structure after a class was already loaded. Therefore, it is typically required that this class file transformer was built while enabling
AgentBuilder.disableClassFormatChanges()
.- Parameters:
instrumentation
- The instrumentation instance from which to deregister the transformer.redefinitionStrategy
- The redefinition to apply.redefinitionDiscoveryStrategy
- The discovery strategy for the types to reset.redefinitionListener
- The redefinition listener to apply.- Returns:
true
if a reset was applied and this transformer was not previously removed.
-
reset
boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled. If it is not enabled, only the
AgentBuilder.InstallationListener
is informed about the resetting without undoing any code changes.Note: A reset class file transformer should not be reinstalled. Instead, the
AgentBuilder
which built the transformer should be asked to install a new transformer.Important: Most JVMs do not support changes of a class's structure after a class was already loaded. Therefore, it is typically required that this class file transformer was built while enabling
AgentBuilder.disableClassFormatChanges()
.- Parameters:
instrumentation
- The instrumentation instance from which to deregister the transformer.redefinitionStrategy
- The redefinition to apply.redefinitionBatchAllocator
- The batch allocator to use.redefinitionListener
- The redefinition listener to apply.- Returns:
true
if a reset was applied and this transformer was not previously removed.
-
reset
boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled. If it is not enabled, only the
AgentBuilder.InstallationListener
is informed about the resetting without undoing any code changes.Note: A reset class file transformer should not be reinstalled. Instead, the
AgentBuilder
which built the transformer should be asked to install a new transformer.Important: Most JVMs do not support changes of a class's structure after a class was already loaded. Therefore, it is typically required that this class file transformer was built while enabling
AgentBuilder.disableClassFormatChanges()
.- Parameters:
instrumentation
- The instrumentation instance from which to deregister the transformer.redefinitionStrategy
- The redefinition to apply.redefinitionDiscoveryStrategy
- The discovery strategy for the types to reset.redefinitionBatchAllocator
- The batch allocator to use.redefinitionListener
- The redefinition listener to apply.- Returns:
true
if a reset was applied and this transformer was not previously removed.
-
reset
boolean reset(Instrumentation instrumentation, ResettableClassFileTransformer classFileTransformer, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, AgentBuilder.RedefinitionStrategy.Listener redefinitionListener) Deregisters this class file transformer and redefines any transformed class to its state without this class file transformer applied, if the supplied redefinition strategy is enabled. If it is not enabled, only the
AgentBuilder.InstallationListener
is informed about the resetting without undoing any code changes.Note: A reset class file transformer should not be reinstalled. Instead, the
AgentBuilder
which built the transformer should be asked to install a new transformer.Important: Most JVMs do not support changes of a class's structure after a class was already loaded. Therefore, it is typically required that this class file transformer was built while enabling
AgentBuilder.disableClassFormatChanges()
.- Parameters:
instrumentation
- The instrumentation instance from which to deregister the transformer.classFileTransformer
- The actual class file transformer to deregister which might bethis
instance or any wrapper.redefinitionStrategy
- The redefinition to apply.redefinitionDiscoveryStrategy
- The discovery strategy for the types to reset.redefinitionBatchAllocator
- The batch allocator to use.redefinitionListener
- The redefinition listener to apply.- Returns:
true
if a reset was applied and this transformer was not previously removed.
-