Class 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 Detail

      • CachedJaxbContext

        public CachedJaxbContext()
    • Method Detail

      • getJaxbContext

        public JAXBContext getJaxbContext​(Class type)
                                   throws 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:
        JAXBException - in the event the JAXBContext cannot be obtained.
      • createUnMarshaller

        public Unmarshaller createUnMarshaller​(Class type)
                                        throws 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:
        JAXBException - in the event the unmarshaller cannot be retrieved.
      • createMarshaller

        public Marshaller createMarshaller​(Class type)
                                    throws 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:
        JAXBException - in the event the marshaller cannot be retrieved.