View Javadoc

1   package com.atlassian.plugins.rest.common.json;
2   
3   import javax.xml.bind.JAXBException;
4   
5   /**
6    * Utility service that will allow clients to marshall a Jaxb bean to Json using the same configuration that the REST
7    * module uses internally to create Json.
8    *
9    * @since v1.0.2
10   */
11  public interface JaxbJsonMarshaller
12  {
13      /**
14       * Given a jaxbBean this method will return a JSON string.
15       *
16       * @param jaxbBean the bean to be converted to JSON
17       * @return a JSON string
18       * @throws JsonMarshallingException if any error occurs marshalling the JSON object
19       * @since 1.1
20       */
21      String marshal(Object jaxbBean) throws JsonMarshallingException;
22  
23      /**
24       * Given a jaxbBean and all the jaxb classes required to convert the bean to JSON this method will return a JSON
25       * string.
26       *
27       * @param jaxbBean    the bean to be converted to JSON
28       * @param jaxbClasses the jaxb classes in use by the jaxb bean.
29       * @return a JSON string
30       * @throws javax.xml.bind.JAXBException if there's a problem marshalling the bean provided
31       * @since 1.0.2
32       * @deprecated since 1.1, use {@link #marshal(Object)}
33       */
34      @Deprecated
35      String marshal(Object jaxbBean, Class... jaxbClasses) throws JAXBException;
36  }