Class ClassFileLocator.AgentBased.ExtractionClassFileTransformer

  • All Implemented Interfaces:
    java.lang.instrument.ClassFileTransformer
    Enclosing class:
    ClassFileLocator.AgentBased

    protected static class ClassFileLocator.AgentBased.ExtractionClassFileTransformer
    extends java.lang.Object
    implements java.lang.instrument.ClassFileTransformer
    A non-operational class file transformer that remembers the binary format of a given class.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private byte[] binaryRepresentation
      The binary representation of the looked-up class.
      private java.lang.ClassLoader classLoader
      The class loader that is expected to have loaded the looked-up a class.
      private static byte[] DO_NOT_TRANSFORM
      An indicator that an attempted class file transformation did not alter the handed class file.
      private java.lang.String typeName
      The name of the type to look up.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected ExtractionClassFileTransformer​(java.lang.ClassLoader classLoader, java.lang.String typeName)
      Creates a class file transformer for the purpose of extraction.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected byte[] getBinaryRepresentation()
      Returns the binary representation of the class file that was looked up.
      byte[] transform​(java.lang.ClassLoader classLoader, java.lang.String internalName, java.lang.Class<?> redefinedType, java.security.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 Detail

      • 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 java.lang.ClassLoader classLoader
        The class loader that is expected to have loaded the looked-up a class.
      • typeName

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

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

      • ExtractionClassFileTransformer

        protected ExtractionClassFileTransformer​(java.lang.ClassLoader classLoader,
                                                 java.lang.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 Detail

      • transform

        public byte[] transform​(java.lang.ClassLoader classLoader,
                                java.lang.String internalName,
                                java.lang.Class<?> redefinedType,
                                java.security.ProtectionDomain protectionDomain,
                                byte[] binaryRepresentation)
        Specified by:
        transform in interface java.lang.instrument.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.