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
unsupportedClassesproperty to exclude any unwanted classes from being marshalled/unmarshalled
- Author:
- Alfonso Vásquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected booleanstatic final Stringprotected Class[]static final StringFields inherited from class org.springframework.oxm.xstream.XStreamMarshaller
DEFAULT_ENCODINGFields inherited from class org.springframework.oxm.support.AbstractMarshaller
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcustomizeXStream(com.thoughtworks.xstream.XStream xstream) voidmarshalWriter(Object graph, Writer writer, com.thoughtworks.xstream.converters.DataHolder dataHolder) Just as super(), but instead of aCompactWritercreates aEscapingCompactWriter.voidsetSuppressXmlDeclaration(boolean suppressXmlDeclaration) voidsetUnsupportedClasses(Class[] unsupportedClasses) booleanReturns 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, unmarshalXmlStreamReaderMethods 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:
customizeXStreamin 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:
supportsin interfaceorg.springframework.oxm.Marshaller- Specified by:
supportsin interfaceorg.springframework.oxm.Unmarshaller- Overrides:
supportsin 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 aCompactWritercreates aEscapingCompactWriter. Also if the object graph is a Dom4j document, the document is written directly instead of using XStream.- Overrides:
marshalWriterin classorg.springframework.oxm.xstream.XStreamMarshaller- Throws:
org.springframework.oxm.XmlMappingExceptionIOException
-