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 Details

    • DO_NOT_TRANSFORM

      private static final byte[] DO_NOT_TRANSFORM
      An indicator that an attempted class file transformation did not alter the handed class file.
    • classLoader

      private final ClassLoader classLoader
      The class loader that is expected to have loaded the looked-up a class.
    • typeName

      private final String typeName
      The name of the type to look up.
    • binaryRepresentation

      private volatile byte[] binaryRepresentation
      The binary representation of the looked-up class.
  • Constructor Details

    • ExtractionClassFileTransformer

      protected ExtractionClassFileTransformer(ClassLoader classLoader, String typeName)
      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

      public byte[] transform(ClassLoader classLoader, String internalName, Class<?> redefinedType, ProtectionDomain protectionDomain, byte[] binaryRepresentation)
      Specified by:
      transform in interface ClassFileTransformer
    • getBinaryRepresentation

      protected byte[] 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.