| java.lang.Object org.springframework.oxm.AbstractMarshaller
All known Subclasses: org.springframework.oxm.jibx.JibxMarshaller, org.springframework.oxm.xmlbeans.XmlBeansMarshaller, org.springframework.oxm.castor.CastorMarshaller, org.springframework.oxm.xstream.XStreamMarshaller,
AbstractMarshaller | abstract public class AbstractMarshaller implements Marshaller,Unmarshaller(Code) | | Abstract implementation of the Marshaller and Unmarshaller interface. This implementation
inspects the given Source or Result , and defers further handling to overridable template
methods.
author: Arjen Poutsma since: 1.0.0 |
Field Summary | |
final protected Log | logger Logger available to subclasses. |
Method Summary | |
protected DocumentBuilder | createDocumentBuilder(DocumentBuilderFactory factory) Create a DocumentBuilder that this marshaller will use for creating DOM documents when passed an
empty DOMSource . | protected DocumentBuilderFactory | createDocumentBuilderFactory() Create a DocumentBuilder that this marshaller will use for creating DOM documents when passed an
empty DOMSource . | protected XMLReader | createXmlReader() Create a XMLReader that this marshaller will when passed an empty SAXSource . | final public void | marshal(Object graph, Result result) Marshals the object graph with the given root into the provided javax.xml.transform.Result . | abstract protected void | marshalDomNode(Object graph, Node node) Abstract template method for marshalling the given object graph to a DOM Node .
In practice, node is be a Document node, a DocumentFragment node, or a
Element node. | protected void | marshalDomResult(Object graph, DOMResult domResult) Template method for handling DOMResult s. | abstract protected void | marshalOutputStream(Object graph, OutputStream outputStream) Abstract template method for marshalling the given object graph to a OutputStream . | abstract protected void | marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler) Abstract template method for marshalling the given object graph to a SAX ContentHandler .
Parameters: graph - the root of the object graph to marshal Parameters: contentHandler - the SAX ContentHandler Parameters: lexicalHandler - the SAX2 LexicalHandler . | protected void | marshalSaxResult(Object graph, SAXResult saxResult) Template method for handling SAXResult s. | protected void | marshalStaxResult(Object graph, StaxResult staxResult) Template method for handling StaxResult s. | protected void | marshalStreamResult(Object graph, StreamResult streamResult) Template method for handling StreamResult s. | abstract protected void | marshalWriter(Object graph, Writer writer) Abstract template method for marshalling the given object graph to a Writer . | abstract protected void | marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter) Abstract template method for marshalling the given object to a StAX XMLEventWriter . | abstract protected void | marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) Abstract template method for marshalling the given object to a StAX XMLStreamWriter . | final public Object | unmarshal(Source source) Unmarshals the given provided javax.xml.transform.Source into an object graph. | abstract protected Object | unmarshalDomNode(Node node) Abstract template method for unmarshalling from a given DOM Node . | protected Object | unmarshalDomSource(DOMSource domSource) Template method for handling DOMSource s. | abstract protected Object | unmarshalInputStream(InputStream inputStream) Abstract template method for unmarshalling from a given InputStream . | abstract protected Object | unmarshalReader(Reader reader) Abstract template method for unmarshalling from a given Reader . | abstract protected Object | unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource) Abstract template method for unmarshalling using a given SAX XMLReader and
InputSource . | protected Object | unmarshalSaxSource(SAXSource saxSource) Template method for handling SAXSource s. | protected Object | unmarshalStaxSource(StaxSource staxSource) Template method for handling StaxSource s. | protected Object | unmarshalStreamSource(StreamSource streamSource) Template method for handling StreamSource s. | abstract protected Object | unmarshalXmlEventReader(XMLEventReader eventReader) Abstract template method for unmarshalling from a given Stax XMLEventReader . | abstract protected Object | unmarshalXmlStreamReader(XMLStreamReader streamReader) Abstract template method for unmarshalling from a given Stax XMLStreamReader . |
logger | final protected Log logger(Code) | | Logger available to subclasses.
|
createDocumentBuilderFactory | protected DocumentBuilderFactory createDocumentBuilderFactory() throws ParserConfigurationException(Code) | | Create a DocumentBuilder that this marshaller will use for creating DOM documents when passed an
empty DOMSource . The resulting DocumentBuilderFactory is cached, so this method will
only be called once.
the DocumentBuilderFactory throws: ParserConfigurationException - if thrown by JAXP methods |
createXmlReader | protected XMLReader createXmlReader() throws SAXException(Code) | | Create a XMLReader that this marshaller will when passed an empty SAXSource .
the XMLReader throws: SAXException - if thrown by JAXP methods |
marshal | final public void marshal(Object graph, Result result) throws XmlMappingException, IOException(Code) | | Marshals the object graph with the given root into the provided javax.xml.transform.Result .
This implementation inspects the given result, and calls marshalDomResult ,
marshalSaxResult , or marshalStreamResult .
Parameters: graph - the root of the object graph to marshal Parameters: result - the result to marshal to throws: XmlMappingException - if the given object cannot be marshalled to the result throws: IOException - if an I/O exception occurs throws: IllegalArgumentException - if result if neither a DOMResult ,SAXResult , StreamResult See Also: AbstractMarshaller.marshalDomResult(Object,javax.xml.transform.dom.DOMResult) See Also: AbstractMarshaller.marshalSaxResult(Object,javax.xml.transform.sax.SAXResult) See Also: AbstractMarshaller.marshalStreamResult(Object,javax.xml.transform.stream.StreamResult) |
marshalDomNode | abstract protected void marshalDomNode(Object graph, Node node) throws XmlMappingException(Code) | | Abstract template method for marshalling the given object graph to a DOM Node .
In practice, node is be a Document node, a DocumentFragment node, or a
Element node. In other words, a node that accepts children.
Parameters: graph - the root of the object graph to marshal Parameters: node - The DOM node that will contain the result tree throws: XmlMappingException - if the given object cannot be marshalled to the DOM node See Also: org.w3c.dom.Document See Also: org.w3c.dom.DocumentFragment See Also: org.w3c.dom.Element |
marshalOutputStream | abstract protected void marshalOutputStream(Object graph, OutputStream outputStream) throws XmlMappingException, IOException(Code) | | Abstract template method for marshalling the given object graph to a OutputStream .
Parameters: graph - the root of the object graph to marshal Parameters: outputStream - the OutputStream to write to throws: XmlMappingException - if the given object cannot be marshalled to the writer throws: IOException - if an I/O exception occurs |
marshalSaxHandlers | abstract protected void marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler) throws XmlMappingException(Code) | | Abstract template method for marshalling the given object graph to a SAX ContentHandler .
Parameters: graph - the root of the object graph to marshal Parameters: contentHandler - the SAX ContentHandler Parameters: lexicalHandler - the SAX2 LexicalHandler . Can be null . throws: XmlMappingException - if the given object cannot be marshalled to the handlers |
marshalStreamResult | protected void marshalStreamResult(Object graph, StreamResult streamResult) throws XmlMappingException, IOException(Code) | | Template method for handling StreamResult s. This implementation defers to
marshalOutputStream , or marshalWriter , depending on what is contained in the
StreamResult
Parameters: graph - the root of the object graph to marshal Parameters: streamResult - the StreamResult throws: IOException - if an I/O Exception occurs throws: XmlMappingException - if the given object cannot be marshalled to the result throws: IllegalArgumentException - if streamResult contains neither OutputStream norWriter . |
marshalWriter | abstract protected void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException(Code) | | Abstract template method for marshalling the given object graph to a Writer .
Parameters: graph - the root of the object graph to marshal Parameters: writer - the Writer to write to throws: XmlMappingException - if the given object cannot be marshalled to the writer throws: IOException - if an I/O exception occurs |
marshalXmlEventWriter | abstract protected void marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter) throws XmlMappingException(Code) | | Abstract template method for marshalling the given object to a StAX XMLEventWriter .
Parameters: graph - the root of the object graph to marshal Parameters: eventWriter - the XMLEventWriter to write to throws: XmlMappingException - if the given object cannot be marshalled to the DOM node |
marshalXmlStreamWriter | abstract protected void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException(Code) | | Abstract template method for marshalling the given object to a StAX XMLStreamWriter .
Parameters: graph - the root of the object graph to marshal Parameters: streamWriter - the XMLStreamWriter to write to throws: XmlMappingException - if the given object cannot be marshalled to the DOM node |
unmarshalDomNode | abstract protected Object unmarshalDomNode(Node node) throws XmlMappingException(Code) | | Abstract template method for unmarshalling from a given DOM Node .
Parameters: node - The DOM node that contains the objects to be unmarshalled the object graph throws: XmlMappingException - if the given DOM node cannot be mapped to an object |
unmarshalSaxReader | abstract protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource) throws XmlMappingException, IOException(Code) | | Abstract template method for unmarshalling using a given SAX XMLReader and
InputSource .
Parameters: xmlReader - the SAX XMLReader to parse with Parameters: inputSource - the input source to parse from the object graph throws: XmlMappingException - if the given reader and input source cannot be converted to an object |
unmarshalStaxSource | protected Object unmarshalStaxSource(StaxSource staxSource) throws XmlMappingException(Code) | | Template method for handling StaxSource s. This implementation defers to
unmarshalXmlStreamReader , or unmarshalXmlEventReader .
Parameters: staxSource - the StaxSource the object graph throws: XmlMappingException - if the given source cannot be mapped to an object |
unmarshalStreamSource | protected Object unmarshalStreamSource(StreamSource streamSource) throws XmlMappingException, IOException(Code) | | Template method for handling StreamSource s. This implementation defers to
unmarshalInputStream , or unmarshalReader .
Parameters: streamSource - the StreamSource the object graph throws: IOException - if an I/O exception occurs throws: XmlMappingException - if the given source cannot be mapped to an object |
unmarshalXmlEventReader | abstract protected Object unmarshalXmlEventReader(XMLEventReader eventReader) throws XmlMappingException(Code) | | Abstract template method for unmarshalling from a given Stax XMLEventReader .
Parameters: eventReader - The XMLEventReader to read from the object graph throws: XmlMappingException - if the given event reader cannot be converted to an object |
unmarshalXmlStreamReader | abstract protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader) throws XmlMappingException(Code) | | Abstract template method for unmarshalling from a given Stax XMLStreamReader .
Parameters: streamReader - The XMLStreamReader to read from the object graph throws: XmlMappingException - if the given stream reader cannot be converted to an object |
|
|