Class XmlSpecificContext
- java.lang.Object
-
- net.officefloor.plugin.xml.marshall.tree.XmlSpecificContext
-
public class XmlSpecificContext extends java.lang.ObjectInstance ofXmlContextfor a particular concrete class.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<XmlMapping>mappingsMappings 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 voidaddXmlMapping(XmlMapping mapping)Adds aXmlMappingto the listing ofXmlMappinginstances for this context.protected voidloadAttributes(java.lang.Class<?> upperBoundType, XmlMappingMetaData[] attributes, TranslatorRegistry translatorRegistry)Loads the attribute mappings for this context.voidmarshall(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 XmlMarshallExceptionInitiate context from the upper bound type of the object.- Parameters:
upperBoundType- Upper bound type of the source object.contextElementName- Name of element ornullif not output element for context.configuration- Configuration of the context.context- Generic context to load child contexts.translatorRegistry- Registry ofTranslatorto translate values.referenceRegistry- Registry ofXmlMappingthat 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 XmlMarshallExceptionInitiate context to specific concrete implementation of the object.- Parameters:
source- The first instance of the object.sourceType-Classof the object.elementName- Name of element ornullif not output element for context.configuration- Configuration of the context.context- Generic context to obtain child contexts.translatorRegistry- Registry ofTranslatorinstances.referenceRegistry- RegistryXmlMappingthat may be referenced.- Throws:
XmlMarshallException- If fails to configure this context.
-
-
Method Detail
-
marshall
public void marshall(java.lang.Object source, XmlOutput output) throws XmlMarshallExceptionDoes 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 XmlMarshallExceptionLoads the attribute mappings for this context.- Parameters:
upperBoundType- Upper bound type of the source object.attributes- Configuration of the attributes.translatorRegistry- Registry ofTranslatorinstances.- Throws:
XmlMarshallException- If fails to load attribute mappings.
-
addXmlMapping
protected void addXmlMapping(XmlMapping mapping)
Adds aXmlMappingto the listing ofXmlMappinginstances for this context.- Parameters:
mapping-XmlMappingto add as next mapping.
-
-