Class ResettableClassFileTransformer.WithDelegation.WithCallback<T>
java.lang.Object
net.bytebuddy.agent.builder.ResettableClassFileTransformer.AbstractBase
net.bytebuddy.agent.builder.ResettableClassFileTransformer.WithDelegation
net.bytebuddy.agent.builder.ResettableClassFileTransformer.WithDelegation.WithCallback<T>
- Type Parameters:
T- The type of the value that is passed between the callback methods.
- All Implemented Interfaces:
ClassFileTransformer, ResettableClassFileTransformer
- Enclosing class:
ResettableClassFileTransformer.WithDelegation
@Enhance
protected static class ResettableClassFileTransformer.WithDelegation.WithCallback<T>
extends ResettableClassFileTransformer.WithDelegation
A class file transformer with a callback.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interfaceA factory that creates a resettable class file transformer depending on the availability of the module system.Nested classes/interfaces inherited from class ResettableClassFileTransformer.WithDelegation
ResettableClassFileTransformer.WithDelegation.Callback<T>, ResettableClassFileTransformer.WithDelegation.Substitutable, ResettableClassFileTransformer.WithDelegation.WithCallback<T>Nested classes/interfaces inherited from interface ResettableClassFileTransformer
ResettableClassFileTransformer.AbstractBase, ResettableClassFileTransformer.WithDelegation -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ResettableClassFileTransformer.WithDelegation.Callback<T> The callback to invoke.private static final ResettableClassFileTransformer.WithDelegation.WithCallback.FactoryThe dispatcher that creates the wrapper instance.Fields inherited from class ResettableClassFileTransformer.WithDelegation
classFileTransformer -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWithCallback(ResettableClassFileTransformer classFileTransformer, ResettableClassFileTransformer.WithDelegation.Callback<T> callback) Creates a delegating class file transformer with callback. -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]doTransform(Object rawModule, ClassLoader classLoader, String internalName, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] binaryRepresentation) Callback between the transformation callbacks.byte[]transform(ClassLoader classLoader, String internalName, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] binaryRepresentation) protected byte[]transform(Object rawModule, ClassLoader classLoader, String internalName, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] binaryRepresentation) A method to delegate to when the module system is supported on the current JVM.Methods inherited from class ResettableClassFileTransformer.WithDelegation
iterator, of, resetMethods inherited from class ResettableClassFileTransformer.AbstractBase
reset, reset, reset, reset, reset, reset, resetMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ClassFileTransformer
transform
-
Field Details
-
DISPATCHER
The dispatcher that creates the wrapper instance. -
callback
The callback to invoke.
-
-
Constructor Details
-
WithCallback
protected WithCallback(ResettableClassFileTransformer classFileTransformer, ResettableClassFileTransformer.WithDelegation.Callback<T> callback) Creates a delegating class file transformer with callback.- Parameters:
classFileTransformer- The class file transformer to delegate to.callback- The callback to invoke.
-
-
Method Details
-
transform
@MaybeNull public byte[] transform(@MaybeNull ClassLoader classLoader, @MaybeNull String internalName, @MaybeNull Class<?> classBeingRedefined, @MaybeNull ProtectionDomain protectionDomain, byte[] binaryRepresentation) throws IllegalClassFormatException - Throws:
IllegalClassFormatException
-
transform
@MaybeNull protected byte[] transform(Object rawModule, @MaybeNull ClassLoader classLoader, @MaybeNull String internalName, @MaybeNull Class<?> classBeingRedefined, @MaybeNull ProtectionDomain protectionDomain, byte[] binaryRepresentation) throws IllegalClassFormatException A method to delegate to when the module system is supported on the current JVM.- Parameters:
rawModule- The instrumented class'sjava.lang.Module.classLoader- The type's class loader ornullif the type is loaded by the bootstrap loader.internalName- The internal name of the instrumented class.classBeingRedefined- The loadedClassbeing redefined ornullif no such class exists.protectionDomain- The instrumented type's protection domain ornullif not available.binaryRepresentation- The class file of the instrumented class in its current state.- Returns:
- The binary representation of the transformed class file or
nullif no transformation should be applied. - Throws:
IllegalClassFormatException- If the class file was found invalid.
-
doTransform
@MaybeNull protected byte[] doTransform(Object rawModule, @MaybeNull ClassLoader classLoader, @MaybeNull String internalName, @MaybeNull Class<?> classBeingRedefined, @MaybeNull ProtectionDomain protectionDomain, byte[] binaryRepresentation) throws IllegalClassFormatException Callback between the transformation callbacks.- Parameters:
rawModule- The instrumented class'sjava.lang.Module.classLoader- The type's class loader ornullif the type is loaded by the bootstrap loader.internalName- The internal name of the instrumented class.classBeingRedefined- The loadedClassbeing redefined ornullif no such class exists.protectionDomain- The instrumented type's protection domain ornullif not available.binaryRepresentation- The class file of the instrumented class in its current state.- Returns:
- The binary representation of the transformed class file or
nullif no transformation should be applied. - Throws:
IllegalClassFormatException- If the class file was found invalid.
-