java.lang.Object | ||
↳ | org.springframework.oxm.support.AbstractMarshaller | |
↳ | org.springframework.oxm.xstream.XStreamMarshaller |
Implementation of the Marshaller
interface for XStream.
By default, XStream does not require any further configuration, though class aliases can be used to have more control over the behavior of XStream.
Due to XStream's API, it is required to set the encoding used for writing to OutputStreams.
It defaults to UTF-8
.
NOTE: XStream is an XML serialization library, not a data binding library. Therefore, it has limited namespace support. As such, it is rather unsuitable for usage within Web services.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | DEFAULT_ENCODING | The default encoding used for stream access: UTF-8. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.oxm.support.AbstractMarshaller
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
| |||||||||||
Returns the XStream instance used by this marshaller.
| |||||||||||
Sets an alias/type map, consisting of string aliases mapped to classes.
| |||||||||||
Sets the aliases by type map, consisting of string aliases mapped to classes.
| |||||||||||
Set the classes for which mappings will be read from class-level JDK 1.5+ annotation metadata.
| |||||||||||
Set annotated classes for which aliases will be read from class-level JDK 1.5+ annotation metadata.
| |||||||||||
Set the auto-detection mode of XStream.
| |||||||||||
Callback that supplies the bean
class loader to
a bean instance. | |||||||||||
Set the
Converters or SingleValueConverters to be registered
with the XStream instance. | |||||||||||
Set the encoding to be used for stream access.
| |||||||||||
Sets a field alias/type map, consiting of field names
| |||||||||||
Specify implicit collection fields, as a Map consisting of
Class instances
mapped to comma separated collection field names. | |||||||||||
Set the XStream mode.
| |||||||||||
Specify omitted fields, as a Map consisting of
Class instances
mapped to comma separated field names. | |||||||||||
Set the XStream hierarchical stream driver to be used with stream readers and writers.
| |||||||||||
Set the classes supported by this marshaller.
| |||||||||||
Set the types to use XML attributes for.
| |||||||||||
Set types to use XML attributes for.
| |||||||||||
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Convert the given XStream exception to an appropriate exception from the
org.springframework.oxm hierarchy. | |||||||||||
Template to allow for customizing of the given XStream.
| |||||||||||
Abstract template method for marshalling the given object graph to a DOM
Node . | |||||||||||
Abstract template method for marshalling the given object graph to a
OutputStream . | |||||||||||
Abstract template method for marshalling the given object graph to a SAX
ContentHandler . | |||||||||||
Abstract template method for marshalling the given object graph to a
Writer . | |||||||||||
Abstract template method for marshalling the given object to a StAX
XMLEventWriter . | |||||||||||
Abstract template method for marshalling the given object to a StAX
XMLStreamWriter . | |||||||||||
Abstract template method for unmarshalling from a given DOM
Node . | |||||||||||
Abstract template method for unmarshalling from a given
InputStream . | |||||||||||
Abstract template method for unmarshalling from a given
Reader . | |||||||||||
Abstract template method for unmarshalling using a given SAX
XMLReader
and InputSource . | |||||||||||
Abstract template method for unmarshalling from a given Stax
XMLEventReader . | |||||||||||
Abstract template method for unmarshalling from a given Stax
XMLStreamReader . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.oxm.support.AbstractMarshaller
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.beans.factory.BeanClassLoaderAware
| |||||||||||
From interface
org.springframework.beans.factory.InitializingBean
| |||||||||||
From interface
org.springframework.oxm.Marshaller
| |||||||||||
From interface
org.springframework.oxm.Unmarshaller
|
The default encoding used for stream access: UTF-8.
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
Exception |
---|
Returns the XStream instance used by this marshaller.
Sets an alias/type map, consisting of string aliases mapped to classes. Keys are aliases; values are either
Class
instances, or String class names.
ClassNotFoundException |
---|
Sets the aliases by type map, consisting of string aliases mapped to classes. Any class that is assignable to
this type will be aliased to the same name. Keys are aliases; values are either
Class
instances, or String class names.
ClassNotFoundException |
---|
Set the classes for which mappings will be read from class-level JDK 1.5+ annotation metadata.
Set annotated classes for which aliases will be read from class-level JDK 1.5+ annotation metadata.
Set the auto-detection mode of XStream.
Note that auto-detection implies that the XStream is configured while it is processing the XML steams, and thus introduces a potential concurrency problem.
Callback that supplies the bean class loader
to
a bean instance.
Invoked after the population of normal bean properties but
before an initialization callback such as
InitializingBean's
afterPropertiesSet()
method or a custom init-method.
classLoader | the owning class loader; may be null in
which case a default ClassLoader must be used, for example
the ClassLoader obtained via
getDefaultClassLoader()
|
---|
Set the Converters
or SingleValueConverters
to be registered
with the XStream
instance.
Sets a field alias/type map, consiting of field names
ClassNotFoundException | |
NoSuchFieldException | |
ClassNotFoundException | |
NoSuchFieldException |
Specify implicit collection fields, as a Map consisting of Class
instances
mapped to comma separated collection field names.
Set the XStream mode.
Specify omitted fields, as a Map consisting of Class
instances
mapped to comma separated field names.
Set the XStream hierarchical stream driver to be used with stream readers and writers.
Set the classes supported by this marshaller.
If this property is empty (the default), all classes are supported.
Set the types to use XML attributes for. The given map can contain
either <String, Class>
pairs, in which case
XStream#useAttributeFor(String, Class) is called.
Alternatively, the map can contain <Class, String>
or <Class, List<String>>
pairs, which results in
XStream#useAttributeFor(Class, String) calls.
Set types to use XML attributes for.
Convert the given XStream exception to an appropriate exception from the
org.springframework.oxm
hierarchy.
A boolean flag is used to indicate whether this exception occurs during marshalling or unmarshalling, since XStream itself does not make this distinction in its exception hierarchy.
ex | XStream exception that occured |
---|---|
marshalling | indicates whether the exception occurs during marshalling (true ),
or unmarshalling (false ) |
XmlMappingException
Template to allow for customizing of the given XStream.
Default implementation is empty.
xstream | the XStream instance
|
---|
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.
graph | the root of the object graph to marshal |
---|---|
node | the DOM node that will contain the result tree |
XmlMappingException |
---|
Abstract template method for marshalling the given object graph to a OutputStream
.
graph | the root of the object graph to marshal |
---|---|
outputStream | the OutputStream to write to |
IOException | |
---|---|
XmlMappingException |
Abstract template method for marshalling the given object graph to a SAX ContentHandler
.
graph | the root of the object graph to marshal |
---|---|
contentHandler | the SAX ContentHandler |
lexicalHandler | the SAX2 LexicalHandler . Can be null . |
XmlMappingException |
---|
Abstract template method for marshalling the given object graph to a Writer
.
graph | the root of the object graph to marshal |
---|---|
writer | the Writer to write to |
IOException | |
---|---|
XmlMappingException |
Abstract template method for marshalling the given object to a StAX XMLEventWriter
.
graph | the root of the object graph to marshal |
---|---|
eventWriter | the XMLEventWriter to write to |
XmlMappingException |
---|
Abstract template method for marshalling the given object to a StAX XMLStreamWriter
.
graph | the root of the object graph to marshal |
---|---|
streamWriter | the XMLStreamWriter to write to |
XmlMappingException |
---|
Abstract template method for unmarshalling from a given DOM Node
.
node | the DOM node that contains the objects to be unmarshalled |
---|
XmlMappingException |
---|
Abstract template method for unmarshalling from a given InputStream
.
inputStream | the InputStreamStream to read from |
---|
IOException | |
---|---|
XmlMappingException |
Abstract template method for unmarshalling from a given Reader
.
reader | the Reader to read from |
---|
IOException | |
---|---|
XmlMappingException |
Abstract template method for unmarshalling using a given SAX XMLReader
and InputSource
.
xmlReader | the SAX XMLReader to parse with |
---|---|
inputSource | the input source to parse from |
IOException | |
---|---|
XmlMappingException |
Abstract template method for unmarshalling from a given Stax XMLEventReader
.
eventReader | the XMLEventReader to read from |
---|
XmlMappingException |
---|
Abstract template method for unmarshalling from a given Stax XMLStreamReader
.
streamReader | the XMLStreamReader to read from |
---|
XmlMappingException |
---|