Class LinkAdapter


  • public class LinkAdapter
    extends XmlAdapter<java.lang.String,​java.lang.Object>
    Used with JAXB to convert from a URL representing an relationship to an object It provides functionality at marshall and unmarshall time At marshall time, the target of a relationship will be marshalled as a URL that could be used to find the object through a REST service At unmarsall time, the URL will be deconstructed and used to find the object in JPA.
    Author:
    tware
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Object constructObjectForId​(java.lang.String entityType, java.lang.Object id)  
      java.lang.String marshal​(java.lang.Object v)
      Convert a bound type to a value type.
      java.lang.Object unmarshal​(java.lang.String v)
      Convert a value type to a bound type.
      • Methods inherited from class java.lang.Object

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

      • LinkAdapter

        public LinkAdapter()
      • LinkAdapter

        public LinkAdapter​(java.lang.String baseURI,
                           PersistenceContext context)
    • Method Detail

      • unmarshal

        public java.lang.Object unmarshal​(java.lang.String v)
                                   throws java.lang.Exception
        Description copied from class: XmlAdapter
        Convert a value type to a bound type.
        Specified by:
        unmarshal in class XmlAdapter<java.lang.String,​java.lang.Object>
        Parameters:
        v - 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.
      • constructObjectForId

        protected java.lang.Object constructObjectForId​(java.lang.String entityType,
                                                        java.lang.Object id)
      • marshal

        public java.lang.String marshal​(java.lang.Object v)
                                 throws java.lang.Exception
        Description copied from class: XmlAdapter
        Convert a bound type to a value type.
        Specified by:
        marshal in class XmlAdapter<java.lang.String,​java.lang.Object>
        Parameters:
        v - The value to be convereted. 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.