Class JacksonFactory.Log4jXmlPrettyPrinter

  • All Implemented Interfaces:
    com.fasterxml.jackson.core.PrettyPrinter, com.fasterxml.jackson.core.util.Instantiatable<com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter>, com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter, java.io.Serializable
    Enclosing class:
    JacksonFactory

    static class JacksonFactory.Log4jXmlPrettyPrinter
    extends com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter
    When <Event>s are written into a XML file; the "Event" object is not the root element, but an element named <Events> created using XmlLayout.getHeader() and XmlLayout.getFooter() methods.

    DefaultXmlPrettyPrinter is used to print the Event object into XML; hence it assumes <Event> tag as the root element, so it prints the <Event> tag without any indentation. To add an indentation to the <Event> tag; hence an additional indentation for any sub-elements, this class is written. As an additional task, to avoid the blank line printed after the ending </Event> tag, writePrologLinefeed(XMLStreamWriter2) method is also overridden.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter

        com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter.FixedSpaceIndenter, com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter.Indenter, com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter.Lf2SpacesIndenter, com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter.NopIndenter
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID  
      • Fields inherited from class com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter

        _arrayIndenter, _justHadStartElement, _nesting, _newLine, _objectIndenter
      • Fields inherited from interface com.fasterxml.jackson.core.PrettyPrinter

        DEFAULT_ROOT_VALUE_SEPARATOR, DEFAULT_SEPARATORS
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter createInstance()
      Sets the nesting level to 1 rather than 0, so the "Event" tag will get indentation of next level below root.
      void writePrologLinefeed​(org.codehaus.stax2.XMLStreamWriter2 sw)  
      • Methods inherited from class com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter

        beforeArrayValues, beforeObjectEntries, indentArraysWith, indentObjectsWith, withCustomNewLine, writeArrayValueSeparator, writeEndArray, writeEndElement, writeEndObject, writeLeafElement, writeLeafElement, writeLeafElement, writeLeafElement, writeLeafElement, writeLeafElement, writeLeafElement, writeLeafElement, writeLeafElement, writeLeafElement, writeLeafNullElement, writeLeafXsiNilElement, writeObjectEntrySeparator, writeObjectFieldValueSeparator, writeRootValueSeparator, writeStartArray, writeStartElement, writeStartObject
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Log4jXmlPrettyPrinter

        Log4jXmlPrettyPrinter​(int nesting)
    • Method Detail

      • writePrologLinefeed

        public void writePrologLinefeed​(org.codehaus.stax2.XMLStreamWriter2 sw)
                                 throws javax.xml.stream.XMLStreamException
        Specified by:
        writePrologLinefeed in interface com.fasterxml.jackson.dataformat.xml.XmlPrettyPrinter
        Overrides:
        writePrologLinefeed in class com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter
        Throws:
        javax.xml.stream.XMLStreamException
      • createInstance

        public com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter createInstance()
        Sets the nesting level to 1 rather than 0, so the "Event" tag will get indentation of next level below root.
        Specified by:
        createInstance in interface com.fasterxml.jackson.core.util.Instantiatable<com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter>
        Overrides:
        createInstance in class com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter