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:
java.lang.instrument.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 Classes Modifier and Type Class Description (package private) static interfaceResettableClassFileTransformer.WithDelegation.WithCallback.FactoryA 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
Fields Modifier and Type Field Description private ResettableClassFileTransformer.WithDelegation.Callback<T>callbackThe callback to invoke.private static ResettableClassFileTransformer.WithDelegation.WithCallback.FactoryDISPATCHERThe dispatcher that creates the wrapper instance.-
Fields inherited from class net.bytebuddy.agent.builder.ResettableClassFileTransformer.WithDelegation
classFileTransformer
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedWithCallback(ResettableClassFileTransformer classFileTransformer, ResettableClassFileTransformer.WithDelegation.Callback<T> callback)Creates a delegating class file transformer with callback.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]doTransform(java.lang.Object rawModule, java.lang.ClassLoader classLoader, java.lang.String internalName, java.lang.Class<?> classBeingRedefined, java.security.ProtectionDomain protectionDomain, byte[] binaryRepresentation)Callback between the transformation callbacks.byte[]transform(java.lang.ClassLoader classLoader, java.lang.String internalName, java.lang.Class<?> classBeingRedefined, java.security.ProtectionDomain protectionDomain, byte[] binaryRepresentation)protected byte[]transform(java.lang.Object rawModule, java.lang.ClassLoader classLoader, java.lang.String internalName, java.lang.Class<?> classBeingRedefined, java.security.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
-
-
-
-
Field Detail
-
DISPATCHER
private static final ResettableClassFileTransformer.WithDelegation.WithCallback.Factory DISPATCHER
The dispatcher that creates the wrapper instance.
-
callback
private final ResettableClassFileTransformer.WithDelegation.Callback<T> callback
The callback to invoke.
-
-
Constructor Detail
-
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 Detail
-
transform
@MaybeNull public byte[] transform(@MaybeNull java.lang.ClassLoader classLoader, @MaybeNull java.lang.String internalName, @MaybeNull java.lang.Class<?> classBeingRedefined, @MaybeNull java.security.ProtectionDomain protectionDomain, byte[] binaryRepresentation) throws java.lang.instrument.IllegalClassFormatException
- Throws:
java.lang.instrument.IllegalClassFormatException
-
transform
@MaybeNull protected byte[] transform(java.lang.Object rawModule, @MaybeNull java.lang.ClassLoader classLoader, @MaybeNull java.lang.String internalName, @MaybeNull java.lang.Class<?> classBeingRedefined, @MaybeNull java.security.ProtectionDomain protectionDomain, byte[] binaryRepresentation) throws java.lang.instrument.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:
java.lang.instrument.IllegalClassFormatException- If the class file was found invalid.
-
doTransform
@MaybeNull protected byte[] doTransform(java.lang.Object rawModule, @MaybeNull java.lang.ClassLoader classLoader, @MaybeNull java.lang.String internalName, @MaybeNull java.lang.Class<?> classBeingRedefined, @MaybeNull java.security.ProtectionDomain protectionDomain, byte[] binaryRepresentation) throws java.lang.instrument.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:
java.lang.instrument.IllegalClassFormatException- If the class file was found invalid.
-
-