Class PersistenceWeaver

  • All Implemented Interfaces:
    javax.persistence.spi.ClassTransformer

    public class PersistenceWeaver
    extends java.lang.Object
    implements javax.persistence.spi.ClassTransformer
    INTERNAL: This class performs dynamic byte code weaving: for each attribute mapped with One To One mapping with Basic Indirection it substitutes the original attribute's type for ValueHolderInterface.
    • Constructor Summary

      Constructors 
      Constructor Description
      PersistenceWeaver​(java.util.Map<java.lang.String,​ClassDetails> classDetailsMap)
      INTERNAL: Creates an instance of dynamic byte code weaver.
      PersistenceWeaver​(org.eclipse.persistence.sessions.Session session, java.util.Map<java.lang.String,​ClassDetails> classDetailsMap)
      Deprecated.
      Session instance is no longer needed for logging.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      INTERNAL: Allow the weaver to be clear to release its referenced memory.
      java.util.Map<java.lang.String,​ClassDetails> getClassDetailsMap()
      INTERNAL: Get Class name in JVM '/' format to ClassDetails map.
      protected static java.lang.String getShortName​(java.lang.String name)
      INTERNAL: Returns an unqualified class name from the specified class name.
      byte[] transform​(java.lang.ClassLoader loader, java.lang.String className, java.lang.Class classBeingRedefined, java.security.ProtectionDomain protectionDomain, byte[] classfileBuffer)
      INTERNAL: Perform dynamic byte code weaving of class.
      • Methods inherited from class java.lang.Object

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

      • classDetailsMap

        protected java.util.Map<java.lang.String,​ClassDetails> classDetailsMap
        Class name in JVM '/' format to ClassDetails map.
    • Constructor Detail

      • PersistenceWeaver

        public PersistenceWeaver​(org.eclipse.persistence.sessions.Session session,
                                 java.util.Map<java.lang.String,​ClassDetails> classDetailsMap)
        Deprecated.
        Session instance is no longer needed for logging. Will be removed in 2.8.
        INTERNAL: Creates an instance of dynamic byte code weaver.
        Parameters:
        session - EclipseLink session (not used so null value is OK).
        classDetailsMap - Class name to ClassDetails map.
      • PersistenceWeaver

        public PersistenceWeaver​(java.util.Map<java.lang.String,​ClassDetails> classDetailsMap)
        INTERNAL: Creates an instance of dynamic byte code weaver.
        Parameters:
        classDetailsMap - Class name to ClassDetails map.
        Since:
        2.7
    • Method Detail

      • clear

        public void clear()
        INTERNAL: Allow the weaver to be clear to release its referenced memory. This is required because the class loader reference to the transformer will never gc.
      • getClassDetailsMap

        public java.util.Map<java.lang.String,​ClassDetails> getClassDetailsMap()
        INTERNAL: Get Class name in JVM '/' format to ClassDetails map.
        Returns:
        Class name in JVM '/' format to ClassDetails map.
      • transform

        public byte[] transform​(java.lang.ClassLoader loader,
                                java.lang.String className,
                                java.lang.Class classBeingRedefined,
                                java.security.ProtectionDomain protectionDomain,
                                byte[] classfileBuffer)
                         throws java.lang.instrument.IllegalClassFormatException
        INTERNAL: Perform dynamic byte code weaving of class.
        Specified by:
        transform in interface javax.persistence.spi.ClassTransformer
        Parameters:
        loader - The defining loader of the class to be transformed, may be null if the bootstrap loader.
        className - The name of the class in the internal form of fully qualified class and interface names.
        classBeingRedefined - If this is a redefine, the class being redefined, otherwise null.
        protectionDomain - The protection domain of the class being defined or redefined.
        classfileBuffer - The input byte buffer in class file format (must not be modified).
        Returns:
        A well-formed class file buffer (the result of the transform), or null if no transform is performed.
        Throws:
        java.lang.instrument.IllegalClassFormatException
      • getShortName

        protected static java.lang.String getShortName​(java.lang.String name)
        INTERNAL: Returns an unqualified class name from the specified class name.
        Parameters:
        name - Class name with '/' as delimiter.
        Returns:
        Unqualified class name.