Package net.bytebuddy.dynamic
Class ClassFileLocator.ForInstrumentation.ExtractionClassFileTransformer
java.lang.Object
net.bytebuddy.dynamic.ClassFileLocator.ForInstrumentation.ExtractionClassFileTransformer
- All Implemented Interfaces:
ClassFileTransformer
- Enclosing class:
- ClassFileLocator.ForInstrumentation
protected static class ClassFileLocator.ForInstrumentation.ExtractionClassFileTransformer
extends Object
implements ClassFileTransformer
A non-operational class file transformer that remembers the binary format of a given class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byte[]
The binary representation of the looked-up class.private final ClassLoader
The class loader that is expected to have loaded the looked-up a class.private static final byte[]
An indicator that an attempted class file transformation did not alter the handed class file.private final String
The name of the type to look up. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ExtractionClassFileTransformer
(ClassLoader classLoader, String typeName) Creates a class file transformer for the purpose of extraction. -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
Returns the binary representation of the class file that was looked up.byte[]
transform
(ClassLoader classLoader, String internalName, Class<?> redefinedType, ProtectionDomain protectionDomain, byte[] binaryRepresentation) 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
-
DO_NOT_TRANSFORM
An indicator that an attempted class file transformation did not alter the handed class file. -
classLoader
The class loader that is expected to have loaded the looked-up a class. -
typeName
The name of the type to look up. -
binaryRepresentation
The binary representation of the looked-up class.
-
-
Constructor Details
-
ExtractionClassFileTransformer
Creates a class file transformer for the purpose of extraction.- Parameters:
classLoader
- The class loader that is expected to have loaded the looked-up a class.typeName
- The name of the type to look up.
-
-
Method Details
-
transform
@MaybeNull public byte[] transform(@MaybeNull ClassLoader classLoader, @MaybeNull String internalName, @MaybeNull Class<?> redefinedType, ProtectionDomain protectionDomain, byte[] binaryRepresentation) - Specified by:
transform
in interfaceClassFileTransformer
-
getBinaryRepresentation
Returns the binary representation of the class file that was looked up. The returned array must never be modified.- Returns:
- The binary representation of the class file or
null
if no such class file could be located.
-