Class CachedJaxbContext
- java.lang.Object
-
- org.apache.directory.fortress.core.rest.CachedJaxbContext
-
public class CachedJaxbContext extends Object
This class contains a very simple caching mechanism for storing JAXBContext objects associated with Fortress XML processing. The intent is to reduce the performance penalty for calling JAXBContext.newInstance( class );This class is thread safe.
- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description CachedJaxbContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.xml.bind.Marshaller
createMarshaller(Class type)
Return a handle to JAXB unmarshaller for a particular data type.jakarta.xml.bind.Unmarshaller
createUnMarshaller(Class type)
Return a handle to JAXB unmarshaller for a particular data type.jakarta.xml.bind.JAXBContext
getJaxbContext(Class type)
Once constructed this object can be stored as static member of class that performs JAX XML processing.
-
-
-
Method Detail
-
getJaxbContext
public jakarta.xml.bind.JAXBContext getJaxbContext(Class type) throws jakarta.xml.bind.JAXBException
Once constructed this object can be stored as static member of class that performs JAX XML processing.- Parameters:
type
- contains the class name that is being marshalled/unmarshalled. *- Returns:
- handle to JAXBContext to be used to marshall or unmarshall XML data.
- Throws:
jakarta.xml.bind.JAXBException
- in the event the JAXBContext cannot be obtained.
-
createUnMarshaller
public jakarta.xml.bind.Unmarshaller createUnMarshaller(Class type) throws jakarta.xml.bind.JAXBException
Return a handle to JAXB unmarshaller for a particular data type. JAXBContext itself is thread safe.- Parameters:
type
- contains the class name associated with a particular data type.- Returns:
- handel to JAXB unmarshaller.
- Throws:
jakarta.xml.bind.JAXBException
- in the event the unmarshaller cannot be retrieved.
-
createMarshaller
public jakarta.xml.bind.Marshaller createMarshaller(Class type) throws jakarta.xml.bind.JAXBException
Return a handle to JAXB unmarshaller for a particular data type. JAXBContext itself is thread safe.- Parameters:
type
- contains the class name associated with a particular data type.- Returns:
- handel to JAXB marshaller.
- Throws:
jakarta.xml.bind.JAXBException
- in the event the marshaller cannot be retrieved.
-
-