Class AbstractValueXmlMapping

java.lang.Object
net.officefloor.plugin.xml.marshall.tree.AbstractXmlMapping
net.officefloor.plugin.xml.marshall.tree.AbstractValueXmlMapping
All Implemented Interfaces:
XmlMapping, XmlWriter
Direct Known Subclasses:
AttributeXmlMapping, ValueXmlMapping

public abstract class AbstractValueXmlMapping extends AbstractXmlMapping
Abstract XmlMapping to aid in writing an attribute/value.
Author:
Daniel Sagenschneider
  • Field Details

    • tagName

      protected final String tagName
      Name of attribute/value.
    • translator

      protected final Translator translator
      Translator to translate the return value of the method to a string value for XML.
    • isUseRaw

      protected final boolean isUseRaw
      Indicates whether the substitution of special characters of XML should not occur.
  • Constructor Details

    • AbstractValueXmlMapping

      public AbstractValueXmlMapping(String tagName, Method getMethod, Translator translator, boolean isUseRaw)
      Initiate with items to write an attribute/value.
      Parameters:
      tagName - Name of attribute/value.
      getMethod - Method to obtain value from object.
      translator - Translates the object to string value for XML.
      isUseRaw - Indicates not to substitute special characters of XML and use raw translated value.
  • Method Details

    • writeXml

      public void writeXml(Object value, XmlOutput output) throws XmlMarshallException
      Description copied from interface: XmlWriter
      Writes the XML for the input object.
      Parameters:
      value - Object to have XML written for it.
      output - Output to write the XML.
      Throws:
      XmlMarshallException - If fails to write the object into XML.
    • writeXml

      protected abstract void writeXml(String tagName, String value, XmlOutput output) throws XmlMarshallException
      Writes the XML.
      Parameters:
      tagName - Tag name for writing XML snippet.
      value - Value of XML snippet.
      output - Output to send the XML snippet.
      Throws:
      XmlMarshallException - If fails to write XML.