Is there a way to map two references in JAXB XML entities for different classes? Example:
<restresource>
<atom:link rel="http://myuri/rels/author" href="http://myuri/users/42" title="That me"/>
<atom:link rel="http://myuri/rels/customer" href="http://myuri/customers/4711" title="John Smith"/>
</restresource>
I would like to map the first link with the XMLAdapter to the User class, and the second to another XMLAdapter for the Customer class. I tried to do this using @XmlPath from EclipseLink JAXB (MOXy) . But the result was not obtained from a large number of experiments, since it is impossible to determine the path with the conditions for "rel". I understand that this can only be done in conjunction with an adapter, because otherwise the definition will not be bidirectional. Any idea how to implement this?
source
share