Class LinkAdapter
- java.lang.Object
-
- javax.xml.bind.annotation.adapters.XmlAdapter<java.lang.String,java.lang.Object>
-
- org.eclipse.persistence.jpa.rs.util.xmladapters.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
-
-
Field Summary
Fields Modifier and Type Field Description protected PersistenceContext
context
-
Constructor Summary
Constructors Constructor Description LinkAdapter()
LinkAdapter(java.lang.String baseURI, PersistenceContext context)
-
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.
-
-
-
Field Detail
-
context
protected PersistenceContext context
-
-
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 classXmlAdapter<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 throughValidationEventHandler
.
-
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 classXmlAdapter<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 throughValidationEventHandler
.
-
-