|
Spring Web Services Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.oxm.AbstractMarshaller org.springframework.oxm.jibx.JibxMarshaller
public class JibxMarshaller
Implementation of the Marshaller
and Unmarshaller
interfaces for JiBX.
targetClass
and optionally the bindingName
property on
this bean, and to refer to it.
IMarshallingContext
,
IUnmarshallingContext
Field Summary |
---|
Fields inherited from class org.springframework.oxm.AbstractMarshaller |
---|
logger |
Constructor Summary | |
---|---|
JibxMarshaller()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
XmlMappingException |
convertJibxException(JiBXException ex,
boolean marshalling)
Convert the given JiBXException to an appropriate exception from the
org.springframework.oxm hierarchy. |
protected IMarshallingContext |
createMarshallingContext()
Creates a new IMarshallingContext , set with the correct indentation. |
protected IUnmarshallingContext |
createUnmarshallingContext()
Creates a new IUnmarshallingContext , set with the correct indentation. |
protected void |
marshalDomNode(Object graph,
Node node)
Abstract template method for marshalling the given object graph to a DOM Node . |
protected void |
marshalOutputStream(Object graph,
OutputStream outputStream)
Abstract template method for marshalling the given object graph to a OutputStream . |
protected void |
marshalSaxHandlers(Object graph,
ContentHandler contentHandler,
LexicalHandler lexicalHandler)
Abstract template method for marshalling the given object graph to a SAX ContentHandler . |
protected void |
marshalWriter(Object graph,
Writer writer)
Abstract template method for marshalling the given object graph to a Writer . |
protected void |
marshalXmlEventWriter(Object graph,
XMLEventWriter eventWriter)
Abstract template method for marshalling the given object to a StAX XMLEventWriter . |
protected void |
marshalXmlStreamWriter(Object graph,
XMLStreamWriter streamWriter)
Abstract template method for marshalling the given object to a StAX XMLStreamWriter . |
void |
setBindingName(String bindingName)
Sets the optional binding name for this instance. |
void |
setEncoding(String encoding)
Sets the document encoding using for marshalling. |
void |
setIndent(int indent)
Sets the number of nesting indent spaces. |
void |
setStandalone(Boolean standalone)
Sets the document standalone flag for marshalling. |
void |
setTargetClass(Class targetClass)
Sets the target class for this instance. |
boolean |
supports(Class clazz)
Indicates whether this marshaller can marshal instances of the supplied type. |
protected Object |
unmarshalDomNode(Node node)
Abstract template method for unmarshalling from a given DOM Node . |
protected Object |
unmarshalInputStream(InputStream inputStream)
Abstract template method for unmarshalling from a given InputStream . |
protected Object |
unmarshalReader(Reader reader)
Abstract template method for unmarshalling from a given Reader . |
protected Object |
unmarshalSaxReader(XMLReader xmlReader,
InputSource inputSource)
Abstract template method for unmarshalling using a given SAX XMLReader and
InputSource . |
protected Object |
unmarshalXmlEventReader(XMLEventReader eventReader)
Abstract template method for unmarshalling from a given Stax XMLEventReader . |
protected Object |
unmarshalXmlStreamReader(XMLStreamReader streamReader)
Abstract template method for unmarshalling from a given Stax XMLStreamReader . |
Methods inherited from class org.springframework.oxm.AbstractMarshaller |
---|
createDocumentBuilder, createDocumentBuilderFactory, createXmlReader, marshal, marshalDomResult, marshalSaxResult, marshalStaxResult, marshalStreamResult, unmarshal, unmarshalDomSource, unmarshalSaxSource, unmarshalStaxSource, unmarshalStreamSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JibxMarshaller()
Method Detail |
---|
public void setBindingName(String bindingName)
public void setTargetClass(Class targetClass)
public void setIndent(int indent)
-1
, i.e. no indentation.
public void setEncoding(String encoding)
public void setStandalone(Boolean standalone)
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public boolean supports(Class clazz)
Marshaller
supports
in interface Marshaller
supports
in interface Unmarshaller
clazz
- the class that this marshaller is being asked if it can marshal
true
if this marshaller can indeed marshal instances of the supplied class;
false
otherwisepublic XmlMappingException convertJibxException(JiBXException ex, boolean marshalling)
JiBXException
to an appropriate exception from the
org.springframework.oxm
hierarchy.
The default implementation delegates to JibxUtils
. Can be overridden in subclasses.
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.
ex
- JiBXException
that occuredmarshalling
- indicates whether the exception occurs during marshalling (true
), or
unmarshalling (false
)
XmlMappingException
instanceJibxUtils.convertJibxException(org.jibx.runtime.JiBXException,boolean)
protected void marshalOutputStream(Object graph, OutputStream outputStream) throws XmlMappingException, IOException
AbstractMarshaller
OutputStream
.
marshalOutputStream
in class AbstractMarshaller
graph
- the root of the object graph to marshaloutputStream
- the OutputStream
to write to
XmlMappingException
- if the given object cannot be marshalled to the writer
IOException
- if an I/O exception occursprotected void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException
AbstractMarshaller
Writer
.
marshalWriter
in class AbstractMarshaller
graph
- the root of the object graph to marshalwriter
- the Writer
to write to
XmlMappingException
- if the given object cannot be marshalled to the writer
IOException
- if an I/O exception occursprotected void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException
AbstractMarshaller
XMLStreamWriter
.
marshalXmlStreamWriter
in class AbstractMarshaller
graph
- the root of the object graph to marshalstreamWriter
- the XMLStreamWriter
to write to
XmlMappingException
- if the given object cannot be marshalled to the DOM nodeprotected void marshalDomNode(Object graph, Node node) throws XmlMappingException
AbstractMarshaller
Node
.
In practice, node is be a Document
node, a DocumentFragment
node, or a
Element
node. In other words, a node that accepts children.
marshalDomNode
in class AbstractMarshaller
graph
- the root of the object graph to marshalnode
- The DOM node that will contain the result tree
XmlMappingException
- if the given object cannot be marshalled to the DOM nodeDocument
,
DocumentFragment
,
Element
protected void marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler) throws XmlMappingException
AbstractMarshaller
ContentHandler
.
marshalSaxHandlers
in class AbstractMarshaller
graph
- the root of the object graph to marshalcontentHandler
- the SAX ContentHandler
lexicalHandler
- the SAX2 LexicalHandler
. Can be null
.
XmlMappingException
- if the given object cannot be marshalled to the handlersprotected void marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter)
AbstractMarshaller
XMLEventWriter
.
marshalXmlEventWriter
in class AbstractMarshaller
graph
- the root of the object graph to marshaleventWriter
- the XMLEventWriter
to write toprotected Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException
AbstractMarshaller
InputStream
.
unmarshalInputStream
in class AbstractMarshaller
inputStream
- the InputStreamStream
to read from
XmlMappingException
- if the given stream cannot be converted to an object
IOException
- if an I/O exception occursprotected Object unmarshalReader(Reader reader) throws XmlMappingException, IOException
AbstractMarshaller
Reader
.
unmarshalReader
in class AbstractMarshaller
reader
- the Reader
to read from
XmlMappingException
- if the given reader cannot be converted to an object
IOException
- if an I/O exception occursprotected Object unmarshalXmlStreamReader(XMLStreamReader streamReader)
AbstractMarshaller
XMLStreamReader
.
unmarshalXmlStreamReader
in class AbstractMarshaller
streamReader
- The XMLStreamReader
to read from
protected Object unmarshalXmlEventReader(XMLEventReader eventReader)
AbstractMarshaller
XMLEventReader
.
unmarshalXmlEventReader
in class AbstractMarshaller
eventReader
- The XMLEventReader
to read from
protected Object unmarshalDomNode(Node node) throws XmlMappingException
AbstractMarshaller
Node
.
unmarshalDomNode
in class AbstractMarshaller
node
- The DOM node that contains the objects to be unmarshalled
XmlMappingException
- if the given DOM node cannot be mapped to an objectprotected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource) throws XmlMappingException, IOException
AbstractMarshaller
XMLReader
and
InputSource
.
unmarshalSaxReader
in class AbstractMarshaller
xmlReader
- the SAX XMLReader
to parse withinputSource
- the input source to parse from
XmlMappingException
- if the given reader and input source cannot be converted to an object
IOException
- if an I/O exception occursprotected IMarshallingContext createMarshallingContext() throws JiBXException
IMarshallingContext
, set with the correct indentation.
JiBXException
- in case of errorsprotected IUnmarshallingContext createUnmarshallingContext() throws JiBXException
IUnmarshallingContext
, set with the correct indentation.
JiBXException
- in case of errors
|
Spring Web Services Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |