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 * Given a jaxbBean this method will return a JSON string.
14 *
15 * @param jaxbBean the bean to be converted to JSON
16 * @return a JSON string
17 * @throws JsonMarshallingException if any error occurs marshalling the JSON object
18 * @since 1.1
19 */
20 String marshal(Object jaxbBean) throws JsonMarshallingException;
21
22 /**
23 * Given a jaxbBean and all the jaxb classes required to convert the bean to JSON this method will return a JSON
24 * string.
25 *
26 * @param jaxbBean the bean to be converted to JSON
27 * @param jaxbClasses the jaxb classes in use by the jaxb bean.
28 * @return a JSON string
29 * @throws javax.xml.bind.JAXBException if there's a problem marshalling the bean provided
30 * @since 1.0.2
31 * @deprecated since 1.1, use {@link #marshal(Object)}
32 */
33 @Deprecated
34 String marshal(Object jaxbBean, Class... jaxbClasses) throws JAXBException;
35 }