Class ReferenceAdapterV2<T extends org.eclipse.persistence.internal.weaving.PersistenceWeavedRest>

  • Type Parameters:
    T - entity class of this adapter

    public class ReferenceAdapterV2<T extends org.eclipse.persistence.internal.weaving.PersistenceWeavedRest>
    extends XmlAdapter<T,​T>
    Reference adapter used in JPARS V2. Main purpose of this adapter is retrieving an entity by link when unmarshalling.
    Author:
    Dmitry Kornilov
    Since:
    EclipseLink 2.6.0
    • Constructor Detail

      • ReferenceAdapterV2

        public ReferenceAdapterV2()
      • ReferenceAdapterV2

        public ReferenceAdapterV2​(PersistenceContext context)
        Instantiates a new reference adapter.
        Parameters:
        context - persistent context (mandatory)
    • Method Detail

      • marshal

        public T marshal​(T o)
                  throws java.lang.Exception
        Marshal just passes through.
        Specified by:
        marshal in class XmlAdapter<T extends org.eclipse.persistence.internal.weaving.PersistenceWeavedRest,​T extends org.eclipse.persistence.internal.weaving.PersistenceWeavedRest>
        Parameters:
        o -
        Returns:
        Throws:
        java.lang.Exception
      • unmarshal

        public T unmarshal​(T o)
                    throws java.lang.Exception
        If 'canonical' or 'self' link is present loads entity from the database. Otherwise uses data provided.
        Specified by:
        unmarshal in class XmlAdapter<T extends org.eclipse.persistence.internal.weaving.PersistenceWeavedRest,​T extends org.eclipse.persistence.internal.weaving.PersistenceWeavedRest>
        Parameters:
        o - The value to be converted. Can be null.
        Throws:
        java.lang.Exception - if there's an error during the conversion. The caller is responsible for reporting the error to the user through ValidationEventHandler.