Class SimpleTagWriter

  • Direct Known Subclasses:
    DateTagWriter, NumberTagWriter

    public class SimpleTagWriter
    extends XMLTagWriter
    Simple xml tag writer holding a fixed tag name and writing the object's toString representation as PCDATA content.
    • Constructor Detail

      • SimpleTagWriter

        public SimpleTagWriter​(XMLTagWriter parent,
                               java.lang.String tagName)
        Creates a new optional simple tag writer.
        Parameters:
        parent - the parent writer, may be null
        tagName - the tag name
      • SimpleTagWriter

        public SimpleTagWriter​(XMLTagWriter parent,
                               java.lang.String tagName,
                               boolean mandatory)
        Creates a new simple tag writer.
        Parameters:
        parent - the parent writer, may be null
        tagName - the tag name
        mandatory - tells whether or not this tag requires a non-null value or not
    • Method Detail

      • writeContent

        protected void writeContent​(org.znerd.xmlenc.XMLOutputter xmlOut,
                                    java.lang.Object object)
                             throws java.io.IOException
        Outputs the given objects by calling its Object.toString() method.
        Specified by:
        writeContent in class XMLTagWriter
        Parameters:
        xmlOut - the XMLOutputter to write to
        object - the data object provided by the parent tag writer, may be null
        Throws:
        java.io.IOException
      • getTagName

        protected java.lang.String getTagName()
        Returns the preset tag name.
        Specified by:
        getTagName in class XMLTagWriter