Interface JaxbBuilder

  • All Known Implementing Classes:
    JaxbFactory

    public interface JaxbBuilder

    Represents a builder used to build JAXB based Marshaller and Unmarshaller instances. Different implementations can be used to determine whether each time new instance is created or an existing instance is returned.

    For performance reasons there should only be one instance of the JAXBContext used throughout the application. The context can than be used to create marshaller and un-marshaller instances. Since the marshallers and un-marshallers are not thread safe one instance should only be used within one thread or synchronization should be applied to avoid threading issues.

    When application is marshalling and un-marshalling larger numbers of small objects, the creation of marshallers and un-marshallers can become an expansive operation. In those cases performance can be approved by sharing marshallers and un-marshallers between multiple threads.

    • Method Detail

      • buildMarshaller

        jakarta.xml.bind.Marshaller buildMarshaller()
                                             throws ProtocolException
        Returns a Marshaller implementation.
        Returns:
        The created Marshaller instance.
        Throws:
        ProtocolException - the marshaller could not be build
      • buildUnmarshaller

        jakarta.xml.bind.Unmarshaller buildUnmarshaller()
                                                 throws ProtocolException
        Returns a Unmarshaller implementation.
        Returns:
        The created Unmarshaller instance.
        Throws:
        ProtocolException - The unmarshaller could not be build
      • getEncoding

        String getEncoding()
        Gets the configured character encoding for the builder.
        Returns:
        - a string, i.e. UTF-8