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.XStreamMarshallerExtension ofXStreamMarshallerthat:- 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
Fields Modifier and Type Field Description static StringDOCUMENT_CLASS_ALIASstatic StringITEM_CLASS_ALIASprotected booleansuppressXmlDeclarationstatic StringTREE_CLASS_ALIASprotected Class[]unsupportedClassesstatic StringXML_DECLARATION
-
Constructor Summary
Constructors Constructor Description CrafterXStreamMarshaller()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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)booleansupports(Class clazz)Returns true if the specified class:-
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 Detail
-
XML_DECLARATION
public static final String XML_DECLARATION
- See Also:
- Constant Field Values
-
ITEM_CLASS_ALIAS
public static final String ITEM_CLASS_ALIAS
- See Also:
- Constant Field Values
-
TREE_CLASS_ALIAS
public static final String TREE_CLASS_ALIAS
- See Also:
- Constant Field Values
-
DOCUMENT_CLASS_ALIAS
public static final String DOCUMENT_CLASS_ALIAS
- See Also:
- Constant Field Values
-
unsupportedClasses
protected Class[] unsupportedClasses
-
suppressXmlDeclaration
protected boolean suppressXmlDeclaration
-
-
Method Detail
-
setUnsupportedClasses
public void setUnsupportedClasses(Class[] unsupportedClasses)
-
setSuppressXmlDeclaration
public void setSuppressXmlDeclaration(boolean suppressXmlDeclaration)
-
customizeXStream
protected void customizeXStream(com.thoughtworks.xstream.XStream xstream)
- Overrides:
customizeXStreamin classorg.springframework.oxm.xstream.XStreamMarshaller
-
supports
public boolean supports(Class clazz)
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
-
-