Class TreeXmlMarshaller
- java.lang.Object
-
- net.officefloor.plugin.xml.marshall.tree.TreeXmlMarshaller
-
- All Implemented Interfaces:
XmlMapping
,XmlWriter
,XmlMarshaller
public class TreeXmlMarshaller extends java.lang.Object implements XmlMarshaller, XmlMapping, XmlWriter
Implementation ofXmlMarshaller
that is capable of marshalling a tree object graph.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description protected XmlContext
context
XmlContext
to handle the root object.
-
Constructor Summary
Constructors Constructor Description TreeXmlMarshaller(XmlMappingMetaData metaData, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry)
Initiate with details to marshall the object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XmlWriter
getWriter()
Obtains theXmlWriter
for this mapping.void
map(java.lang.Object object, XmlOutput output)
Maps the object into XML.void
marshall(java.lang.Object source, XmlOutput output)
Marshalls the source object as XML to the output.void
writeXml(java.lang.Object object, XmlOutput output)
Writes the XML for the input object.
-
-
-
Field Detail
-
context
protected final XmlContext context
XmlContext
to handle the root object.
-
-
Constructor Detail
-
TreeXmlMarshaller
public TreeXmlMarshaller(XmlMappingMetaData metaData, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry) throws XmlMarshallException
Initiate with details to marshall the object.- Parameters:
metaData
- Meta-data of the mappings.translatorRegistry
- Registry ofTranslator
instances for marshalling values.referenceRegistry
- RegistryXmlMapping
that may be referenced.- Throws:
XmlMarshallException
- If fail to configure.
-
-
Method Detail
-
marshall
public void marshall(java.lang.Object source, XmlOutput output) throws XmlMarshallException
Description copied from interface:XmlMarshaller
Marshalls the source object as XML to the output.- Specified by:
marshall
in interfaceXmlMarshaller
- Parameters:
source
- Object to marshall into XML.output
- Output to send the XML.- Throws:
XmlMarshallException
- If fails to marshall source.
-
map
public void map(java.lang.Object object, XmlOutput output) throws XmlMarshallException
Description copied from interface:XmlMapping
Maps the object into XML.- Specified by:
map
in interfaceXmlMapping
- Parameters:
object
- Object to map into XML.output
- Output to send the XML.- Throws:
XmlMarshallException
- If fails to map object into XML.
-
getWriter
public XmlWriter getWriter()
Description copied from interface:XmlMapping
Obtains theXmlWriter
for this mapping.- Specified by:
getWriter
in interfaceXmlMapping
- Returns:
XmlWriter
for this mapping.
-
writeXml
public void writeXml(java.lang.Object object, XmlOutput output) throws XmlMarshallException
Description copied from interface:XmlWriter
Writes the XML for the input object.- Specified by:
writeXml
in interfaceXmlWriter
- Parameters:
object
- Object to have XML written for it.output
- Output to write the XML.- Throws:
XmlMarshallException
- If fails to write the object into XML.
-
-