T
- Java type supported by the provider.public abstract class AbstractJaxbProvider<T> extends AbstractMessageReaderWriterProvider<T>
UTF8
Constructor and Description |
---|
AbstractJaxbProvider(Providers providers,
Configuration config)
Inheritance constructor.
|
AbstractJaxbProvider(Providers providers,
MediaType resolverMediaType,
Configuration config)
Inheritance constructor.
|
Modifier and Type | Method and Description |
---|---|
protected jakarta.xml.bind.Marshaller |
getMarshaller(Class type,
MediaType mediaType)
Get the JAXB marshaller for the given class and media type.
|
protected static SAXSource |
getSAXSource(SAXParserFactory spf,
InputStream entityStream)
Create new
SAXSource for a given entity input stream. |
protected jakarta.xml.bind.JAXBContext |
getStoredJaxbContext(Class type)
Retrieve cached JAXB context capable of handling the given Java type.
|
protected jakarta.xml.bind.Unmarshaller |
getUnmarshaller(Class type,
MediaType mediaType)
Get the JAXB unmarshaller for the given class and media type.
|
protected boolean |
isFormattedOutput() |
protected boolean |
isSupported(MediaType mediaType)
Check if the given media type is supported by this JAXB entity provider.
|
protected boolean |
isXmlRootElementProcessing() |
void |
setConfiguration(Configuration config) |
protected void |
setHeader(jakarta.xml.bind.Marshaller marshaller,
Annotation[] annotations)
Set the custom XML header on a JAXB marshaller if specified via
XmlHeader annotation,
present in the supplied array of annotations. |
getCharset, getSize, readFromAsString, writeTo, writeTo, writeToAsString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isReadable, readFrom
isWriteable, writeTo
public AbstractJaxbProvider(Providers providers, Configuration config)
providers
- JAX-RS providers.public AbstractJaxbProvider(Providers providers, MediaType resolverMediaType, Configuration config)
providers
- JAX-RS providers.resolverMediaType
- JAXB component context resolver media type to be used.public void setConfiguration(Configuration config)
protected boolean isSupported(MediaType mediaType)
Subclasses can override this method. Default implementation always returns true
.
mediaType
- media type to be checked for support.true
if the media type is supported by the entity provider, false
otherwise.protected final jakarta.xml.bind.Unmarshaller getUnmarshaller(Class type, MediaType mediaType) throws jakarta.xml.bind.JAXBException
In case this provider instance has been created with a fixed resolver media type
, the supplied media type argument will be ignored.
type
- Java type to be unmarshalled.mediaType
- entity media type.jakarta.xml.bind.JAXBException
- in case retrieving the unmarshaller fails with a JAXB exception.protected final jakarta.xml.bind.Marshaller getMarshaller(Class type, MediaType mediaType) throws jakarta.xml.bind.JAXBException
In case this provider instance has been created with a fixed resolver media type
, the supplied media type argument will be ignored.
type
- Java type to be marshalled.mediaType
- entity media type.jakarta.xml.bind.JAXBException
- in case retrieving the marshaller fails with a JAXB exception.protected jakarta.xml.bind.JAXBContext getStoredJaxbContext(Class type) throws jakarta.xml.bind.JAXBException
type
- Java type .jakarta.xml.bind.JAXBException
- in case the JAXB context retrieval fails.protected static SAXSource getSAXSource(SAXParserFactory spf, InputStream entityStream) throws jakarta.xml.bind.JAXBException
SAXSource
for a given entity input stream.spf
- SAX parser factory to be used to create the SAX source.entityStream
- entity input stream.SAXSource
representing the entity input stream.jakarta.xml.bind.JAXBException
- in case SAX source creation fails.protected boolean isFormattedOutput()
protected boolean isXmlRootElementProcessing()
protected void setHeader(jakarta.xml.bind.Marshaller marshaller, Annotation[] annotations)
XmlHeader
annotation,
present in the supplied array of annotations.marshaller
- JAXB marshaller.annotations
- array of annotations that MAY contain a XmlHeader
annotation instance.Copyright © 2007-2023, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.