1   package com.atlassian.plugins.rest.common.json;
2   
3   import com.sun.jersey.api.json.JSONConfiguration;
4   import com.sun.jersey.api.json.JSONJAXBContext;
5   
6   import javax.xml.bind.JAXBException;
7   
8   /**
9    * Creates a JSONJAXBContext using the {@link com.sun.jersey.api.json.JSONConfiguration#natural()} configuration.
10   *
11   * @since v1.0.2
12   */
13  public class DefaultJsonJaxbContextFactory implements JsonJaxbContextFactory
14  {
15      public JSONJAXBContext createContext(final Class... classes)
16      {
17          try
18          {
19              return new JSONJAXBContext(JSONConfiguration.natural().build(), classes);
20          }
21          catch (JAXBException e)
22          {
23              throw new RuntimeException("Could not create JAXB JSON context", e);
24          }
25      }
26  }