Package net.bytebuddy.agent.builder
Interface ResettableClassFileTransformer.WithDelegation.Callback<T>
- Type Parameters:
T
- The type of the value that is passed between the callback methods.
- Enclosing class:
ResettableClassFileTransformer.WithDelegation
public static interface ResettableClassFileTransformer.WithDelegation.Callback<T>
A callback that is invoked upon class file transformation.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onAfterTransform
(T value, JavaModule module, ClassLoader classLoader, String internalName, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] binaryRepresentation) Invoked after the transformation is applied.onBeforeTransform
(JavaModule module, ClassLoader classLoader, String internalName, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] binaryRepresentation) Invoked before the transformation is applied.
-
Method Details
-
onBeforeTransform
@MaybeNull T onBeforeTransform(@MaybeNull JavaModule module, @MaybeNull ClassLoader classLoader, @MaybeNull String internalName, @MaybeNull Class<?> classBeingRedefined, @MaybeNull ProtectionDomain protectionDomain, byte[] binaryRepresentation) throws IllegalClassFormatException Invoked before the transformation is applied.- Parameters:
module
- The instrumented class's Java module ornull
if the module system is not supported.classLoader
- The type's class loader ornull
if the type is loaded by the bootstrap loader.internalName
- The internal name of the instrumented class.classBeingRedefined
- The loadedClass
being redefined ornull
if no such class exists.protectionDomain
- The instrumented type's protection domain ornull
if not available.binaryRepresentation
- The class file of the instrumented class in its current state.- Returns:
- A value to pass to the method that is invoked after transformation or
null
. - Throws:
IllegalClassFormatException
- If the class file was found invalid.
-
onAfterTransform
void onAfterTransform(@MaybeNull T value, @MaybeNull JavaModule module, @MaybeNull ClassLoader classLoader, @MaybeNull String internalName, @MaybeNull Class<?> classBeingRedefined, @MaybeNull ProtectionDomain protectionDomain, byte[] binaryRepresentation) throws IllegalClassFormatException Invoked after the transformation is applied.- Parameters:
value
- The value that was returned before transformation.module
- The instrumented class's Java module ornull
if the module system is not supported.classLoader
- The type's class loader ornull
if the type is loaded by the bootstrap loader.internalName
- The internal name of the instrumented class.classBeingRedefined
- The loadedClass
being redefined ornull
if no such class exists.protectionDomain
- The instrumented type's protection domain ornull
if not available.binaryRepresentation
- The class file of the instrumented class in its current state.- Throws:
IllegalClassFormatException
- If the class file was found invalid.
-