Package net.bytebuddy.agent.builder
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 interface
A factory that creates a resettable class file transformer depending on the availability of the module system.Nested classes/interfaces inherited from class net.bytebuddy.agent.builder.ResettableClassFileTransformer.WithDelegation
ResettableClassFileTransformer.WithDelegation.Callback<T>, ResettableClassFileTransformer.WithDelegation.Substitutable, ResettableClassFileTransformer.WithDelegation.WithCallback<T>
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.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.Factory
The dispatcher that creates the wrapper instance.Fields inherited from class net.bytebuddy.agent.builder.ResettableClassFileTransformer.WithDelegation
classFileTransformer
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
WithCallback
(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 net.bytebuddy.agent.builder.ResettableClassFileTransformer.WithDelegation
iterator, of, reset
Methods inherited from class net.bytebuddy.agent.builder.ResettableClassFileTransformer.AbstractBase
reset, reset, reset, reset, reset, reset, reset
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.instrument.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 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:
- The binary representation of the transformed class file or
null
if 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 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:
- The binary representation of the transformed class file or
null
if no transformation should be applied. - Throws:
IllegalClassFormatException
- If the class file was found invalid.
-