Class JLIClassTransformer

  • All Implemented Interfaces:
    ClassTransformer

    public final class JLIClassTransformer
    extends java.lang.Object
    implements ClassTransformer
    A wrapper around a ClassFileTransformer.
    • Constructor Summary

      Constructors 
      Constructor Description
      JLIClassTransformer​(java.lang.instrument.ClassFileTransformer transformer)
      Construct a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.ByteBuffer transform​(java.lang.ClassLoader loader, java.lang.String className, java.security.ProtectionDomain protectionDomain, java.nio.ByteBuffer classBytes)
      Transform the bytes of a class.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JLIClassTransformer

        public JLIClassTransformer​(java.lang.instrument.ClassFileTransformer transformer)
        Construct a new instance.
        Parameters:
        transformer - the delegate transformer (must not be null)
    • Method Detail

      • transform

        public java.nio.ByteBuffer transform​(java.lang.ClassLoader loader,
                                             java.lang.String className,
                                             java.security.ProtectionDomain protectionDomain,
                                             java.nio.ByteBuffer classBytes)
                                      throws java.lang.IllegalArgumentException
        Description copied from interface: ClassTransformer
        Transform the bytes of a class. The position and limit of both the passed-in and returned buffers must mark the start and end of the class bytes.
        Specified by:
        transform in interface ClassTransformer
        Parameters:
        loader - the class loader of the class being transformed
        className - the internal name of the class being transformed (not null)
        protectionDomain - the protection domain of the class, if any
        classBytes - the class bytes being transformed (not null; may be a direct or heap buffer)
        Returns:
        the transformation result (may be a direct or heap buffer)
        Throws:
        java.lang.IllegalArgumentException - if the class could not be transformed for some reason