Interface JaxbBuilder
- All Known Implementing Classes:
JaxbFactory
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 Summary
Modifier and TypeMethodDescriptionjakarta.xml.bind.MarshallerReturns aMarshallerimplementation.jakarta.xml.bind.UnmarshallerReturns aUnmarshallerimplementation.Gets the configured character encoding for the builder.
-
Method Details
-
buildMarshaller
Returns aMarshallerimplementation.- Returns:
- The created
Marshallerinstance. - Throws:
ProtocolException- the marshaller could not be build
-
buildUnmarshaller
Returns aUnmarshallerimplementation.- Returns:
- The created
Unmarshallerinstance. - 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
-