Class JAXBContextResolver

java.lang.Object
org.exoplatform.services.rest.impl.provider.JAXBContextResolver
All Implemented Interfaces:
javax.ws.rs.ext.ContextResolver<JAXBContextResolver>

@Provider public class JAXBContextResolver extends Object implements javax.ws.rs.ext.ContextResolver<JAXBContextResolver>
Provide cache for JAXBContext.
Version:
$Id: $
Author:
Andrey Parfonov
  • Constructor Details

    • JAXBContextResolver

      public JAXBContextResolver()
  • Method Details

    • getContext

      public JAXBContextResolver getContext(Class<?> type)
      Specified by:
      getContext in interface javax.ws.rs.ext.ContextResolver<JAXBContextResolver>
    • getJAXBContext

      public javax.xml.bind.JAXBContext getJAXBContext(Class<?> clazz) throws javax.xml.bind.JAXBException
      Return JAXBContext according to supplied type. If no one context found then try create new context and save it in cache.
      Parameters:
      clazz - classes to be bound
      Returns:
      JAXBContext
      Throws:
      javax.xml.bind.JAXBException - if JAXBContext creation failed
    • createJAXBContext

      public javax.xml.bind.JAXBContext createJAXBContext(Class<?> clazz) throws javax.xml.bind.JAXBException
      Create and add in cache JAXBContext for supplied set of classes.
      Parameters:
      clazz - set of java classes to be bound
      Returns:
      JAXBContext
      Throws:
      javax.xml.bind.JAXBException - if JAXBContext for supplied classes can't be created in any reasons
    • addJAXBContext

      public void addJAXBContext(javax.xml.bind.JAXBContext jaxbctx, Class<?> clazz)
      Add prepared JAXBContext that will be mapped to set of class. In this case this class works as cache for JAXBContexts.
      Parameters:
      jaxbctx - JAXBContext
      clazz - set of java classes to be bound
    • addPlugin

      public void addPlugin(org.exoplatform.container.component.ComponentPlugin plugin)
      Parameters:
      plugin - for injection prepared JAXBContext at startup