Class JaxbFactory
- java.lang.Object
-
- com.sportradar.livedata.sdk.proto.common.JaxbFactory
-
- All Implemented Interfaces:
JaxbBuilder
public class JaxbFactory extends Object implements JaxbBuilder
Represents a factory used to create jaxb basedMarshaller
andUnmarshaller
instances.
-
-
Constructor Summary
Constructors Constructor Description JaxbFactory(jakarta.xml.bind.JAXBContext context)
Initializes a new instance of theJaxbFactory
class.JaxbFactory(jakarta.xml.bind.JAXBContext context, SchemaFactory schemaFactory, Source schemaSource)
Initializes a new instance of theJaxbFactory
class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.xml.bind.Marshaller
buildMarshaller()
Creates and returns aMarshaller
implementation.jakarta.xml.bind.Unmarshaller
buildUnmarshaller()
Creates and returns aUnmarshaller
implementation.String
getEncoding()
Gets the configured character encoding for the builder.
-
-
-
Field Detail
-
ENCODING
public static final String ENCODING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JaxbFactory
@Inject public JaxbFactory(jakarta.xml.bind.JAXBContext context)
Initializes a new instance of theJaxbFactory
class.- Parameters:
context
- TheJAXBContext
used to create marshallers and un-marshallers.- Throws:
IllegalArgumentException
- Thecontext
is a null reference.
-
JaxbFactory
public JaxbFactory(jakarta.xml.bind.JAXBContext context, SchemaFactory schemaFactory, Source schemaSource)
Initializes a new instance of theJaxbFactory
class.- Parameters:
context
- TheJAXBContext
used to create marshallers and un-marshallers.schemaFactory
- TheSchemaFactory
used to createSchema
which is used to validate the data before un-marshalling it or a null reference in no validation is required.schemaSource
- TheSource
containing schema definition. This argument is only required when theschemaFactory
is not a null reference. Otherwise this argument is ignored.- Throws:
IllegalArgumentException
- Thecontext
is a null reference orschemaFactory
is a null reference orschemaSource
is a null reference.
-
-
Method Detail
-
buildMarshaller
public jakarta.xml.bind.Marshaller buildMarshaller() throws ProtocolException
Creates and returns aMarshaller
implementation. Note that each time this method is called new instance of the marshaller is created.- Specified by:
buildMarshaller
in interfaceJaxbBuilder
- Returns:
- The created
Marshaller
instance. - Throws:
ProtocolException
- wrapped JAXBException.
-
buildUnmarshaller
public jakarta.xml.bind.Unmarshaller buildUnmarshaller() throws ProtocolException
Creates and returns aUnmarshaller
implementation. Note that each time this method is called new instance of the un-marshaller is created.- Specified by:
buildUnmarshaller
in interfaceJaxbBuilder
- 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 interfaceJaxbBuilder
- Returns:
- - a string, i.e. UTF-8
-
-