Class XmlSpecificContext

java.lang.Object
net.officefloor.plugin.xml.marshall.tree.XmlSpecificContext

public class XmlSpecificContext extends Object
Instance of XmlContext for a particular concrete class.
Author:
Daniel Sagenschneider
  • Field Details

    • mappings

      protected final List<XmlMapping> 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 or null if not output element for context.
      configuration - Configuration of the context.
      context - Generic context to load child contexts.
      translatorRegistry - Registry of Translator to translate values.
      referenceRegistry - Registry of XmlMapping that 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 - Class of the object.
      elementName - Name of element or null if not output element for context.
      configuration - Configuration of the context.
      context - Generic context to obtain child contexts.
      translatorRegistry - Registry of Translator instances.
      referenceRegistry - Registry XmlMapping that may be referenced.
      Throws:
      XmlMarshallException - If fails to configure this context.
  • Method Details

    • marshall

      public void marshall(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(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 of Translator instances.
      Throws:
      XmlMarshallException - If fails to load attribute mappings.
    • addXmlMapping

      protected void addXmlMapping(XmlMapping mapping)
      Adds a XmlMapping to the listing of XmlMapping instances for this context.
      Parameters:
      mapping - XmlMapping to add as next mapping.