Class XmlSpecificContext
- java.lang.Object
-
- net.officefloor.plugin.xml.marshall.tree.XmlSpecificContext
-
public class XmlSpecificContext extends java.lang.Object
Instance ofXmlContext
for a particular concrete class.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<XmlMapping>
mappings
Mappings to be applied for this context.
-
Constructor Summary
Constructors Constructor Description XmlSpecificContext(java.lang.Class<?> upperBoundType, java.lang.String contextElementName, XmlMappingMetaData[] configuration, XmlContext context, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry)
Initiate context from the upper bound type of the object.XmlSpecificContext(java.lang.Object source, java.lang.Class<?> sourceType, java.lang.String elementName, XmlMappingMetaData[] configuration, XmlContext context, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry)
Initiate context to specific concrete implementation of the object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addXmlMapping(XmlMapping mapping)
Adds aXmlMapping
to the listing ofXmlMapping
instances for this context.protected void
loadAttributes(java.lang.Class<?> upperBoundType, XmlMappingMetaData[] attributes, TranslatorRegistry translatorRegistry)
Loads the attribute mappings for this context.void
marshall(java.lang.Object source, XmlOutput output)
Does the marshalling of the source object to the output.
-
-
-
Field Detail
-
mappings
protected final java.util.List<XmlMapping> mappings
Mappings to be applied for this context.
-
-
Constructor Detail
-
XmlSpecificContext
public XmlSpecificContext(java.lang.Class<?> upperBoundType, java.lang.String contextElementName, XmlMappingMetaData[] configuration, XmlContext context, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry) throws XmlMarshallException
Initiate context from the upper bound type of the object.- Parameters:
upperBoundType
- Upper bound type of the source object.contextElementName
- Name of element ornull
if not output element for context.configuration
- Configuration of the context.context
- Generic context to load child contexts.translatorRegistry
- Registry ofTranslator
to translate values.referenceRegistry
- Registry ofXmlMapping
that may be referenced.- Throws:
XmlMarshallException
- If fails to configure this context.
-
XmlSpecificContext
public XmlSpecificContext(java.lang.Object source, java.lang.Class<?> sourceType, java.lang.String elementName, XmlMappingMetaData[] configuration, XmlContext context, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry) throws XmlMarshallException
Initiate context to specific concrete implementation of the object.- Parameters:
source
- The first instance of the object.sourceType
-Class
of the object.elementName
- Name of element ornull
if not output element for context.configuration
- Configuration of the context.context
- Generic context to obtain child contexts.translatorRegistry
- Registry ofTranslator
instances.referenceRegistry
- RegistryXmlMapping
that may be referenced.- Throws:
XmlMarshallException
- If fails to configure this context.
-
-
Method Detail
-
marshall
public void marshall(java.lang.Object source, XmlOutput output) throws XmlMarshallException
Does the marshalling of the source object to the output.- Parameters:
source
- Source object to marshall.output
- Output to send XML.- Throws:
XmlMarshallException
- If fails to marshall source object.
-
loadAttributes
protected void loadAttributes(java.lang.Class<?> upperBoundType, XmlMappingMetaData[] attributes, TranslatorRegistry translatorRegistry) throws XmlMarshallException
Loads the attribute mappings for this context.- Parameters:
upperBoundType
- Upper bound type of the source object.attributes
- Configuration of the attributes.translatorRegistry
- Registry ofTranslator
instances.- Throws:
XmlMarshallException
- If fails to load attribute mappings.
-
addXmlMapping
protected void addXmlMapping(XmlMapping mapping)
Adds aXmlMapping
to the listing ofXmlMapping
instances for this context.- Parameters:
mapping
-XmlMapping
to add as next mapping.
-
-