Class CrafterXStreamMarshaller
java.lang.Object
org.springframework.oxm.support.AbstractMarshaller
org.springframework.oxm.xstream.XStreamMarshaller
org.craftercms.core.util.xml.marshalling.xstream.CrafterXStreamMarshaller
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.InitializingBean
,org.springframework.oxm.Marshaller
,org.springframework.oxm.Unmarshaller
public class CrafterXStreamMarshaller
extends org.springframework.oxm.xstream.XStreamMarshaller
Extension of
XStreamMarshaller
that:
- Provides correct marshalling/unmarshalling support for Crafter objects.
- Adds a
unsupportedClasses
property to exclude any unwanted classes from being marshalled/unmarshalled
- Author:
- Alfonso Vásquez
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
protected boolean
static final String
protected Class[]
static final String
Fields inherited from class org.springframework.oxm.xstream.XStreamMarshaller
DEFAULT_ENCODING
Fields inherited from class org.springframework.oxm.support.AbstractMarshaller
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
customizeXStream
(com.thoughtworks.xstream.XStream xstream) void
marshalWriter
(Object graph, Writer writer, com.thoughtworks.xstream.converters.DataHolder dataHolder) Just as super(), but instead of aCompactWriter
creates aEscapingCompactWriter
.void
setSuppressXmlDeclaration
(boolean suppressXmlDeclaration) void
setUnsupportedClasses
(Class[] unsupportedClasses) boolean
Returns true if the specified class: Is NOT the same, a subclass or subinterface of one of the unsupported classes. Is the the same, a subclass or subinterface of one of the supported classes. Also returns true if there aren't any unsupported or supported classes.Methods inherited from class org.springframework.oxm.xstream.XStreamMarshaller
afterPropertiesSet, buildXStream, configureXStream, constructXStream, convertXStreamException, getDefaultEncoding, getXStream, marshalDomNode, marshalOutputStream, marshalOutputStream, marshalSaxHandlers, marshalWriter, marshalXmlEventWriter, marshalXmlStreamWriter, setAliases, setAliasesByType, setAnnotatedClasses, setAutodetectAnnotations, setBeanClassLoader, setConverterLookup, setConverterRegistry, setConverters, setEncoding, setFieldAliases, setImplicitCollections, setMapper, setMapperWrappers, setMarshallingStrategy, setMode, setNameCoder, setOmittedFields, setReflectionProvider, setStreamDriver, setSupportedClasses, setTypePermissions, setUseAttributeFor, setUseAttributeForTypes, unmarshalDomNode, unmarshalInputStream, unmarshalInputStream, unmarshalReader, unmarshalReader, unmarshalSaxReader, unmarshalStreamSource, unmarshalXmlEventReader, unmarshalXmlStreamReader
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
-
Field Details
-
XML_DECLARATION
- See Also:
-
ITEM_CLASS_ALIAS
- See Also:
-
TREE_CLASS_ALIAS
- See Also:
-
DOCUMENT_CLASS_ALIAS
- See Also:
-
unsupportedClasses
-
suppressXmlDeclaration
protected boolean suppressXmlDeclaration
-
-
Constructor Details
-
CrafterXStreamMarshaller
public CrafterXStreamMarshaller()
-
-
Method Details
-
setUnsupportedClasses
-
setSuppressXmlDeclaration
public void setSuppressXmlDeclaration(boolean suppressXmlDeclaration) -
customizeXStream
protected void customizeXStream(com.thoughtworks.xstream.XStream xstream) - Overrides:
customizeXStream
in classorg.springframework.oxm.xstream.XStreamMarshaller
-
supports
Returns true if the specified class:- Is NOT the same, a subclass or subinterface of one of the unsupported classes.
- Is the the same, a subclass or subinterface of one of the supported classes.
- Specified by:
supports
in interfaceorg.springframework.oxm.Marshaller
- Specified by:
supports
in interfaceorg.springframework.oxm.Unmarshaller
- Overrides:
supports
in classorg.springframework.oxm.xstream.XStreamMarshaller
-
marshalWriter
public void marshalWriter(Object graph, Writer writer, com.thoughtworks.xstream.converters.DataHolder dataHolder) throws org.springframework.oxm.XmlMappingException, IOException Just as super(), but instead of aCompactWriter
creates aEscapingCompactWriter
. Also if the object graph is a Dom4j document, the document is written directly instead of using XStream.- Overrides:
marshalWriter
in classorg.springframework.oxm.xstream.XStreamMarshaller
- Throws:
org.springframework.oxm.XmlMappingException
IOException
-