Class JaxbFactory

  • All Implemented Interfaces:
    JaxbBuilder

    public class JaxbFactory
    extends Object
    implements JaxbBuilder
    Represents a factory used to create jaxb based Marshaller and Unmarshaller instances.
    • Constructor Detail

      • JaxbFactory

        @Inject
        public JaxbFactory​(jakarta.xml.bind.JAXBContext context)
        Initializes a new instance of the JaxbFactory class.
        Parameters:
        context - The JAXBContext used to create marshallers and un-marshallers.
        Throws:
        IllegalArgumentException - The context is a null reference.
      • JaxbFactory

        public JaxbFactory​(jakarta.xml.bind.JAXBContext context,
                           SchemaFactory schemaFactory,
                           Source schemaSource)
        Initializes a new instance of the JaxbFactory class.
        Parameters:
        context - The JAXBContext used to create marshallers and un-marshallers.
        schemaFactory - The SchemaFactory used to create Schema which is used to validate the data before un-marshalling it or a null reference in no validation is required.
        schemaSource - The Source containing schema definition. This argument is only required when the schemaFactory is not a null reference. Otherwise this argument is ignored.
        Throws:
        IllegalArgumentException - The context is a null reference or schemaFactory is a null reference or schemaSource is a null reference.
    • Method Detail

      • buildMarshaller

        public jakarta.xml.bind.Marshaller buildMarshaller()
                                                    throws ProtocolException
        Creates and returns a Marshaller implementation. Note that each time this method is called new instance of the marshaller is created.
        Specified by:
        buildMarshaller in interface JaxbBuilder
        Returns:
        The created Marshaller instance.
        Throws:
        ProtocolException - wrapped JAXBException.
      • buildUnmarshaller

        public jakarta.xml.bind.Unmarshaller buildUnmarshaller()
                                                        throws ProtocolException
        Creates and returns a Unmarshaller implementation. Note that each time this method is called new instance of the un-marshaller is created.
        Specified by:
        buildUnmarshaller in interface JaxbBuilder
        Returns:
        The created Unmarshaller instance.
        Throws:
        ProtocolException - wrapped JAXBException.
      • getEncoding

        public String getEncoding()
        Gets the configured character encoding for the builder.
        Specified by:
        getEncoding in interface JaxbBuilder
        Returns:
        - a string, i.e. UTF-8