Class JibxMarshaller
- java.lang.Object
- org.springframework.oxm.support.AbstractMarshaller
- org.springframework.oxm.jibx.JibxMarshaller
- All Implemented Interfaces:
InitializingBean
,Marshaller
,Unmarshaller
@Deprecated public class JibxMarshaller extends AbstractMarshaller implements InitializingBean
Deprecated.as of Spring Framework 5.1.5, due to the lack of activity on the JiBX projectImplementation of theMarshaller
andUnmarshaller
interfaces for JiBX.The typical usage will be to set the
targetClass
and optionally thebindingName
property on this bean.- Since:
- 3.0
- Author:
- Arjen Poutsma
- See Also:
IMarshallingContext
,IUnmarshallingContext
Field Summary
Fields inherited from class org.springframework.oxm.support.AbstractMarshaller
logger
Constructor Summary
Constructors Constructor Description JibxMarshaller()
Deprecated.
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
afterPropertiesSet()
Deprecated.Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.XmlMappingException
convertJibxException(org.jibx.runtime.JiBXException ex, boolean marshalling)
Deprecated.Convert the givenJiBXException
to an appropriate exception from theorg.springframework.oxm
hierarchy.protected org.jibx.runtime.IMarshallingContext
createMarshallingContext()
Deprecated.Create a newIMarshallingContext
, configured with the correct indentation.protected org.jibx.runtime.IUnmarshallingContext
createUnmarshallingContext()
Deprecated.Create a newIUnmarshallingContext
.protected String
getDefaultEncoding()
Deprecated.Determine the default encoding to use for marshalling or unmarshalling from a byte stream, ornull
if none.protected void
marshalDomNode(Object graph, Node node)
Deprecated.Abstract template method for marshalling the given object graph to a DOMNode
.protected void
marshalOutputStream(Object graph, OutputStream outputStream)
Deprecated.Abstract template method for marshalling the given object graph to aOutputStream
.protected void
marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler)
Deprecated.Abstract template method for marshalling the given object graph to a SAXContentHandler
.protected void
marshalWriter(Object graph, Writer writer)
Deprecated.Abstract template method for marshalling the given object graph to aWriter
.protected void
marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter)
Deprecated.Abstract template method for marshalling the given object to a StAXXMLEventWriter
.protected void
marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter)
Deprecated.Abstract template method for marshalling the given object to a StAXXMLStreamWriter
.void
setBindingName(String bindingName)
Deprecated.Set the optional binding name for this instance.void
setDocTypeInternalSubset(String docTypeInternalSubset)
Deprecated.Set the internal subset Id for the DTD declaration written when marshalling.void
setDocTypePublicId(String docTypePublicId)
Deprecated.Set the public id for the DTD declaration written when marshalling.void
setDocTypeRootElementName(String docTypeRootElementName)
Deprecated.Set the root element name for the DTD declaration written when marshalling.void
setDocTypeSystemId(String docTypeSystemId)
Deprecated.Set the system id for the DTD declaration written when marshalling.void
setEncoding(String encoding)
Deprecated.Set the document encoding using for marshalling.void
setIndent(int indent)
Deprecated.Set the number of nesting indent spaces.void
setStandalone(Boolean standalone)
Deprecated.Set the document standalone flag for marshalling.void
setTargetClass(Class<?> targetClass)
Deprecated.Set the target class for this instance.void
setTargetPackage(String targetPackage)
Deprecated.Set the target package for this instance.boolean
supports(Class<?> clazz)
Deprecated.Indicate whether this marshaller can marshal instances of the supplied type.protected Object
unmarshalDomNode(Node node)
Deprecated.Abstract template method for unmarshalling from a given DOMNode
.protected Object
unmarshalInputStream(InputStream inputStream)
Deprecated.Abstract template method for unmarshalling from a givenInputStream
.protected Object
unmarshalReader(Reader reader)
Deprecated.Abstract template method for unmarshalling from a givenReader
.protected Object
unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource)
Deprecated.Abstract template method for unmarshalling using a given SAXXMLReader
andInputSource
.protected Object
unmarshalXmlEventReader(XMLEventReader eventReader)
Deprecated.Abstract template method for unmarshalling from a given StaxXMLEventReader
.protected Object
unmarshalXmlStreamReader(XMLStreamReader streamReader)
Deprecated.Abstract template method for unmarshalling from a given StaxXMLStreamReader
.Methods inherited from class org.springframework.oxm.support.AbstractMarshaller
buildDocument, createDocumentBuilder, createDocumentBuilderFactory, createXmlReader, isProcessExternalEntities, isSupportDtd, marshal, marshalDomResult, marshalSaxResult, marshalStaxResult, marshalStreamResult, setProcessExternalEntities, setSupportDtd, unmarshal, unmarshalDomSource, unmarshalSaxSource, unmarshalStaxSource, unmarshalStreamSource
Constructor Detail
JibxMarshaller
public JibxMarshaller()
Deprecated.
Method Detail
setTargetClass
public void setTargetClass(Class<?> targetClass)
Deprecated.Set the target class for this instance. Setting either this property or thetargetPackage
property is required.If this property is set,
targetPackage
is ignored.
setTargetPackage
public void setTargetPackage(String targetPackage)
Deprecated.Set the target package for this instance. Setting either this property or thetargetClass
property is required.If
targetClass
is set, this property is ignored.
setBindingName
public void setBindingName(String bindingName)
Deprecated.Set the optional binding name for this instance.
setIndent
public void setIndent(int indent)
Deprecated.Set the number of nesting indent spaces. Default is-1
, i.e. no indentation.
setEncoding
public void setEncoding(String encoding)
Deprecated.Set the document encoding using for marshalling. Default is UTF-8.
getDefaultEncoding
protected String getDefaultEncoding()
Deprecated.Description copied from class:AbstractMarshaller
Determine the default encoding to use for marshalling or unmarshalling from a byte stream, ornull
if none.The default implementation returns
null
.- Overrides:
getDefaultEncoding
in classAbstractMarshaller
setStandalone
public void setStandalone(Boolean standalone)
Deprecated.Set the document standalone flag for marshalling. By default, this flag is not present.
setDocTypeRootElementName
public void setDocTypeRootElementName(String docTypeRootElementName)
Deprecated.Set the root element name for the DTD declaration written when marshalling. By default, this isnull
(i.e. no DTD declaration is written).If set to a value, the system ID or public ID also need to be set.
setDocTypeSystemId
public void setDocTypeSystemId(String docTypeSystemId)
Deprecated.Set the system id for the DTD declaration written when marshalling. By default, this isnull
. Only used when the root element also has been set.Set either this property or
docTypePublicId
, not both.- See Also:
setDocTypeRootElementName(String)
setDocTypePublicId
public void setDocTypePublicId(String docTypePublicId)
Deprecated.Set the public id for the DTD declaration written when marshalling. By default, this isnull
. Only used when the root element also has been set.Set either this property or
docTypeSystemId
, not both.- See Also:
setDocTypeRootElementName(String)
setDocTypeInternalSubset
public void setDocTypeInternalSubset(String docTypeInternalSubset)
Deprecated.Set the internal subset Id for the DTD declaration written when marshalling. By default, this isnull
. Only used when the root element also has been set.- See Also:
setDocTypeRootElementName(String)
afterPropertiesSet
public void afterPropertiesSet() throws org.jibx.runtime.JiBXException
Deprecated.Description copied from interface:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
org.jibx.runtime.JiBXException
supports
public boolean supports(Class<?> clazz)
Deprecated.Description copied from interface:Marshaller
Indicate whether this marshaller can marshal instances of the supplied type.- Specified by:
supports
in interfaceMarshaller
- Specified by:
supports
in interfaceUnmarshaller
- Parameters:
clazz
- the class that this marshaller is being asked if it can marshal- Returns:
true
if this marshaller can indeed marshal instances of the supplied class;false
otherwise
marshalOutputStream
protected void marshalOutputStream(Object graph, OutputStream outputStream) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for marshalling the given object graph to aOutputStream
.- Specified by:
marshalOutputStream
in classAbstractMarshaller
- Parameters:
graph
- the root of the object graph to marshaloutputStream
- theOutputStream
to write to- Throws:
XmlMappingException
- if the given object cannot be marshalled to the writerIOException
- if an I/O exception occurs
marshalWriter
protected void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for marshalling the given object graph to aWriter
.- Specified by:
marshalWriter
in classAbstractMarshaller
- Parameters:
graph
- the root of the object graph to marshalwriter
- theWriter
to write to- Throws:
XmlMappingException
- if the given object cannot be marshalled to the writerIOException
- if an I/O exception occurs
marshalDomNode
protected void marshalDomNode(Object graph, Node node) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for marshalling the given object graph to a DOMNode
.In practice, node is be a
Document
node, aDocumentFragment
node, or aElement
node. In other words, a node that accepts children.- Specified by:
marshalDomNode
in classAbstractMarshaller
- Parameters:
graph
- the root of the object graph to marshalnode
- the DOM node that will contain the result tree- Throws:
XmlMappingException
- if the given object cannot be marshalled to the DOM node- See Also:
Document
,DocumentFragment
,Element
marshalXmlEventWriter
protected void marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter)
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for marshalling the given object to a StAXXMLEventWriter
.- Specified by:
marshalXmlEventWriter
in classAbstractMarshaller
- Parameters:
graph
- the root of the object graph to marshaleventWriter
- theXMLEventWriter
to write to
marshalXmlStreamWriter
protected void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for marshalling the given object to a StAXXMLStreamWriter
.- Specified by:
marshalXmlStreamWriter
in classAbstractMarshaller
- Parameters:
graph
- the root of the object graph to marshalstreamWriter
- theXMLStreamWriter
to write to- Throws:
XmlMappingException
- if the given object cannot be marshalled to the DOM node
marshalSaxHandlers
protected void marshalSaxHandlers(Object graph, ContentHandler contentHandler, @Nullable LexicalHandler lexicalHandler) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for marshalling the given object graph to a SAXContentHandler
.- Specified by:
marshalSaxHandlers
in classAbstractMarshaller
- Parameters:
graph
- the root of the object graph to marshalcontentHandler
- the SAXContentHandler
lexicalHandler
- the SAX2LexicalHandler
. Can benull
.- Throws:
XmlMappingException
- if the given object cannot be marshalled to the handlers
unmarshalXmlEventReader
protected Object unmarshalXmlEventReader(XMLEventReader eventReader)
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for unmarshalling from a given StaxXMLEventReader
.- Specified by:
unmarshalXmlEventReader
in classAbstractMarshaller
- Parameters:
eventReader
- theXMLEventReader
to read from- Returns:
- the object graph
unmarshalXmlStreamReader
protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader)
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for unmarshalling from a given StaxXMLStreamReader
.- Specified by:
unmarshalXmlStreamReader
in classAbstractMarshaller
- Parameters:
streamReader
- theXMLStreamReader
to read from- Returns:
- the object graph
unmarshalInputStream
protected Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for unmarshalling from a givenInputStream
.- Specified by:
unmarshalInputStream
in classAbstractMarshaller
- Parameters:
inputStream
- theInputStreamStream
to read from- Returns:
- the object graph
- Throws:
XmlMappingException
- if the given stream cannot be converted to an objectIOException
- if an I/O exception occurs
unmarshalReader
protected Object unmarshalReader(Reader reader) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for unmarshalling from a givenReader
.- Specified by:
unmarshalReader
in classAbstractMarshaller
- Parameters:
reader
- theReader
to read from- Returns:
- the object graph
- Throws:
XmlMappingException
- if the given reader cannot be converted to an objectIOException
- if an I/O exception occurs
unmarshalDomNode
protected Object unmarshalDomNode(Node node) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for unmarshalling from a given DOMNode
.- Specified by:
unmarshalDomNode
in classAbstractMarshaller
- Parameters:
node
- the DOM node that contains the objects to be unmarshalled- Returns:
- the object graph
- Throws:
XmlMappingException
- if the given DOM node cannot be mapped to an object
unmarshalSaxReader
protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshaller
Abstract template method for unmarshalling using a given SAXXMLReader
andInputSource
.- Specified by:
unmarshalSaxReader
in classAbstractMarshaller
- Parameters:
xmlReader
- the SAXXMLReader
to parse withinputSource
- the input source to parse from- Returns:
- the object graph
- Throws:
XmlMappingException
- if the given reader and input source cannot be converted to an objectIOException
- if an I/O exception occurs
createMarshallingContext
protected org.jibx.runtime.IMarshallingContext createMarshallingContext() throws org.jibx.runtime.JiBXException
Deprecated.Create a newIMarshallingContext
, configured with the correct indentation.- Returns:
- the created marshalling context
- Throws:
org.jibx.runtime.JiBXException
- in case of errors
createUnmarshallingContext
protected org.jibx.runtime.IUnmarshallingContext createUnmarshallingContext() throws org.jibx.runtime.JiBXException
Deprecated.Create a newIUnmarshallingContext
.- Returns:
- the created unmarshalling context
- Throws:
org.jibx.runtime.JiBXException
- in case of errors
convertJibxException
public XmlMappingException convertJibxException(org.jibx.runtime.JiBXException ex, boolean marshalling)
Deprecated.Convert the givenJiBXException
to an appropriate exception from theorg.springframework.oxm
hierarchy.A boolean flag is used to indicate whether this exception occurs during marshalling or unmarshalling, since JiBX itself does not make this distinction in its exception hierarchy.
- Parameters:
ex
-JiBXException
that occurredmarshalling
- indicates whether the exception occurs during marshalling (true
), or unmarshalling (false
)- Returns:
- the corresponding
XmlMappingException