Class XmlSpecificContext
java.lang.Object
net.officefloor.plugin.xml.marshall.tree.XmlSpecificContext
Instance of
XmlContext for a
particular concrete class.- Author:
- Daniel Sagenschneider
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<XmlMapping>Mappings to be applied for this context. -
Constructor Summary
ConstructorsConstructorDescriptionXmlSpecificContext(Class<?> upperBoundType, String contextElementName, XmlMappingMetaData[] configuration, XmlContext context, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry) Initiate context from the upper bound type of the object.XmlSpecificContext(Object source, Class<?> sourceType, String elementName, XmlMappingMetaData[] configuration, XmlContext context, TranslatorRegistry translatorRegistry, ReferencedXmlMappingRegistry referenceRegistry) Initiate context to specific concrete implementation of the object. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddXmlMapping(XmlMapping mapping) Adds aXmlMappingto the listing ofXmlMappinginstances for this context.protected voidloadAttributes(Class<?> upperBoundType, XmlMappingMetaData[] attributes, TranslatorRegistry translatorRegistry) Loads the attribute mappings for this context.voidDoes the marshalling of the source object to the output.
-
Field Details
-
mappings
Mappings to be applied for this context.
-
-
Constructor Details
-
XmlSpecificContext
public XmlSpecificContext(Class<?> upperBoundType, 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 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(Object source, Class<?> sourceType, 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-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 Details
-
marshall
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(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 ofTranslatorinstances.- Throws:
XmlMarshallException- If fails to load attribute mappings.
-
addXmlMapping
Adds aXmlMappingto the listing ofXmlMappinginstances for this context.- Parameters:
mapping-XmlMappingto add as next mapping.
-