java.lang.Object
jakarta.xml.bind.annotation.adapters.XmlAdapter<JaxbLink,Link>
org.glassfish.jersey.examples.linking.representation.JaxbAdapter

public class JaxbAdapter extends jakarta.xml.bind.annotation.adapters.XmlAdapter<JaxbLink,Link>
An implementation of JAXB XmlAdapter that maps the JAX-RS Link type to a value that can be marshalled and unmarshalled by JAXB. The following example shows how to use this adapter on a JAXB bean class:
 @XmlRootElement
 public class MyModel {

   private Link link;

   @XmlElement(name="link")
   @XmlJavaTypeAdapter(JaxbAdapter.class)
   public Link getLink() {
     return link;
   }
   ...
 }
 

Note that usage of this class requires the Jakarta XML Binding API and an implementation. The Jakarta RESTful Web Services implementation is not required to provide these dependencies.

The class used to be a part Jakarta REST 3.1

Since:
4.0
See Also:
  • Constructor Details

    • JaxbAdapter

      public JaxbAdapter()
  • Method Details

    • unmarshal

      public Link unmarshal(JaxbLink v)
      Convert a JaxbLink into a Link.
      Specified by:
      unmarshal in class jakarta.xml.bind.annotation.adapters.XmlAdapter<JaxbLink,Link>
      Parameters:
      v - instance of type JaxbLink.
      Returns:
      mapped instance of type JaxbLink
    • marshal

      public JaxbLink marshal(Link v)
      Convert a Link into a JaxbLink.
      Specified by:
      marshal in class jakarta.xml.bind.annotation.adapters.XmlAdapter<JaxbLink,Link>
      Parameters:
      v - instance of type Link.
      Returns:
      mapped instance of type JaxbLink.