Class AbstractTypeXmlMapping
- java.lang.Object
-
- net.officefloor.plugin.xml.marshall.tree.AbstractXmlMapping
-
- net.officefloor.plugin.xml.marshall.tree.AbstractTypeXmlMapping
-
- All Implemented Interfaces:
XmlMapping
,XmlWriter
- Direct Known Subclasses:
CollectionXmlMapping
,TypeXmlMapping
public abstract class AbstractTypeXmlMapping extends AbstractXmlMapping
AbstractXmlMapping
to aid in type specific mapping.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Class<?>,XmlSpecificContext>
contexts
Mapping of concrete type to its context.protected java.lang.String
elementEnd
Ending XML tag to surround the collection.protected java.lang.String
elementName
Name of XML element for this mapping.protected java.lang.String
elementStart
Starting XML tag to surround the collection.protected java.util.List<net.officefloor.plugin.xml.marshall.tree.TypeItem>
items
Contains the configurations for the various types potentially held within the collection.-
Fields inherited from class net.officefloor.plugin.xml.marshall.tree.AbstractXmlMapping
getMethod
-
-
Constructor Summary
Constructors Constructor Description AbstractTypeXmlMapping(java.lang.String elementName, java.lang.reflect.Method getMethod, XmlMappingMetaData[] items, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry)
Initiate with details to map specific sub-types.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected XmlSpecificContext
getMatchingContext(java.lang.Object specificObject)
Obtains the matchingXmlSpecificContext
for the input type.protected abstract void
writeSpecificXml(java.lang.Object object, XmlOutput output)
Writes the specific XML for the input object.void
writeXml(java.lang.Object object, XmlOutput output)
Writes the XML for the input object.-
Methods inherited from class net.officefloor.plugin.xml.marshall.tree.AbstractXmlMapping
getWriter, map
-
-
-
-
Field Detail
-
contexts
protected final java.util.Map<java.lang.Class<?>,XmlSpecificContext> contexts
Mapping of concrete type to its context.
-
items
protected final java.util.List<net.officefloor.plugin.xml.marshall.tree.TypeItem> items
Contains the configurations for the various types potentially held within the collection.
-
elementName
protected final java.lang.String elementName
Name of XML element for this mapping.
-
elementStart
protected final java.lang.String elementStart
Starting XML tag to surround the collection.
-
elementEnd
protected final java.lang.String elementEnd
Ending XML tag to surround the collection.
-
-
Constructor Detail
-
AbstractTypeXmlMapping
public AbstractTypeXmlMapping(java.lang.String elementName, java.lang.reflect.Method getMethod, XmlMappingMetaData[] items, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry) throws XmlMarshallException
Initiate with details to map specific sub-types.- Parameters:
elementName
- Name of XML element for this mapping ornull
if no element.getMethod
- Method to obtain the collection.items
- Configuration for items to match to sub-types.referenceRegistry
- Registry ofXmlMapping
that may be referenced.translatorRegistry
- Registry of theTranslator
instances.- Throws:
XmlMarshallException
- If fails to configure.
-
-
Method Detail
-
writeXml
public void writeXml(java.lang.Object object, XmlOutput output) throws XmlMarshallException
Description copied from interface:XmlWriter
Writes the XML for the input object.- 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.
-
writeSpecificXml
protected abstract void writeSpecificXml(java.lang.Object object, XmlOutput output) throws XmlMarshallException
Writes the specific XML for the input object.- Parameters:
object
- Object to be written as XML.output
- Output to write the XML.- Throws:
XmlMarshallException
- If fails to write the XML.
-
getMatchingContext
protected XmlSpecificContext getMatchingContext(java.lang.Object specificObject) throws XmlMarshallException
Obtains the matchingXmlSpecificContext
for the input type.- Parameters:
specificObject
- Specific object to obtain theXmlSpecificContext
.- Returns:
XmlSpecificContext
specific to input type.- Throws:
XmlMarshallException
- If fails to obtain a matchingXmlSpecificContext
.
-
-