Class StaticWeaveClassTransformer


  • public class StaticWeaveClassTransformer
    extends java.lang.Object

    Description: This class provides the implementation of class transformer by leveraging on the following existing APIs,

    • PersistenceUnitProcessor.processORMetadata() - get class descriptor.
    • PersistenceUnitProcessor.buildEntityList() - get entity classes lsit.
    • TransformerFactory.createTransformerAndModifyProject - get class transformer.

    Responsibilities:

    • Create the classtransformer for each persistence unit individually and store them into the list.
    • Provide class transfom method to perform weaving function.
    • Constructor Summary

      Constructors 
      Constructor Description
      StaticWeaveClassTransformer​(java.net.URL inputArchiveURL, java.lang.ClassLoader aclassloader)
      Constructs an instance of StaticWeaveClassTransformer.
      StaticWeaveClassTransformer​(java.net.URL inputArchiveURL, java.lang.String persistenceXMLLocation, java.lang.ClassLoader aclassloader, java.io.Writer logWriter, int loglevel)
      Constructs an instance of StaticWeaveClassTransformer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] transform​(java.lang.String originalClassName, java.lang.Class originalClass, byte[] originalClassBytes)
      The method performs weaving function on the given class.
      • Methods inherited from class java.lang.Object

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

      • StaticWeaveClassTransformer

        public StaticWeaveClassTransformer​(java.net.URL inputArchiveURL,
                                           java.lang.ClassLoader aclassloader)
                                    throws java.lang.Exception
        Constructs an instance of StaticWeaveClassTransformer.
        Throws:
        java.lang.Exception
      • StaticWeaveClassTransformer

        public StaticWeaveClassTransformer​(java.net.URL inputArchiveURL,
                                           java.lang.String persistenceXMLLocation,
                                           java.lang.ClassLoader aclassloader,
                                           java.io.Writer logWriter,
                                           int loglevel)
                                    throws java.net.URISyntaxException,
                                           java.io.IOException
        Constructs an instance of StaticWeaveClassTransformer.
        Throws:
        java.net.URISyntaxException
        java.io.IOException
    • Method Detail

      • transform

        public byte[] transform​(java.lang.String originalClassName,
                                java.lang.Class originalClass,
                                byte[] originalClassBytes)
                         throws java.lang.instrument.IllegalClassFormatException
        The method performs weaving function on the given class.
        Returns:
        the converted(woven) class
        Throws:
        java.lang.instrument.IllegalClassFormatException