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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddJAXBContext(javax.xml.bind.JAXBContext jaxbctx, Class<?> clazz) Add prepared JAXBContext that will be mapped to set of class.voidaddPlugin(org.exoplatform.container.component.ComponentPlugin plugin) javax.xml.bind.JAXBContextcreateJAXBContext(Class<?> clazz) Create and add in cache JAXBContext for supplied set of classes.getContext(Class<?> type) javax.xml.bind.JAXBContextgetJAXBContext(Class<?> clazz) Return JAXBContext according to supplied type.
-
Constructor Details
-
JAXBContextResolver
public JAXBContextResolver()
-
-
Method Details
-
getContext
- Specified by:
getContextin interfacejavax.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
Add prepared JAXBContext that will be mapped to set of class. In this case this class works as cache for JAXBContexts.- Parameters:
jaxbctx- JAXBContextclazz- 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
-