public class DefaultXmlPrettyPrinter extends Object implements XmlPrettyPrinter, com.fasterxml.jackson.core.util.Instantiatable<DefaultXmlPrettyPrinter>, Serializable
Note that only a subset of methods of PrettyPrinter
actually
get called by ToXmlGenerator
; because of this, implementation
is bit briefer (and uglier...).
Modifier and Type | Class and Description |
---|---|
protected static class |
DefaultXmlPrettyPrinter.FixedSpaceIndenter
This is a very simple indenter that only every adds a
single space for indentation.
|
static interface |
DefaultXmlPrettyPrinter.Indenter
Interface that defines objects that can produce indentation used
to separate object entries and array values.
|
protected static class |
DefaultXmlPrettyPrinter.Lf2SpacesIndenter
Default linefeed-based indenter uses system-specific linefeeds and
2 spaces for indentation per level.
|
protected static class |
DefaultXmlPrettyPrinter.NopIndenter
Dummy implementation that adds no indentation whatsoever
|
Modifier and Type | Field and Description |
---|---|
protected DefaultXmlPrettyPrinter.Indenter |
_arrayIndenter
By default, let's use only spaces to separate array values.
|
protected boolean |
_justHadStartElement
Marker flag set on start element, and cleared if an end element
is encountered.
|
protected int |
_nesting
Number of open levels of nesting.
|
protected DefaultXmlPrettyPrinter.Indenter |
_objectIndenter
By default, let's use linefeed-adding indenter for separate
object entries.
|
protected boolean |
_spacesInObjectEntries
By default we will add spaces around colons used to
separate object fields and values.
|
Modifier | Constructor and Description |
---|---|
|
DefaultXmlPrettyPrinter() |
protected |
DefaultXmlPrettyPrinter(DefaultXmlPrettyPrinter base) |
Modifier and Type | Method and Description |
---|---|
void |
beforeArrayValues(com.fasterxml.jackson.core.JsonGenerator gen) |
void |
beforeObjectEntries(com.fasterxml.jackson.core.JsonGenerator gen) |
DefaultXmlPrettyPrinter |
createInstance() |
void |
indentArraysWith(DefaultXmlPrettyPrinter.Indenter i) |
void |
indentObjectsWith(DefaultXmlPrettyPrinter.Indenter i) |
void |
spacesInObjectEntries(boolean b) |
void |
writeArrayValueSeparator(com.fasterxml.jackson.core.JsonGenerator gen) |
void |
writeEndArray(com.fasterxml.jackson.core.JsonGenerator gen,
int nrOfValues) |
void |
writeEndElement(org.codehaus.stax2.XMLStreamWriter2 sw,
int nrOfEntries)
Method for forcibly writing an end element, without going
through Jackson generator (and thus, without updating currently
active element stack)
|
void |
writeEndObject(com.fasterxml.jackson.core.JsonGenerator gen,
int nrOfEntries) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
BigDecimal value) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
BigInteger value) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
boolean value) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
byte[] data,
int offset,
int len) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
char[] buffer,
int offset,
int len,
boolean isCData) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
double value) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
float value) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
int value) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
long value) |
void |
writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName,
String text,
boolean isCData) |
void |
writeLeafNullElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName) |
void |
writeObjectEntrySeparator(com.fasterxml.jackson.core.JsonGenerator gen) |
void |
writeObjectFieldValueSeparator(com.fasterxml.jackson.core.JsonGenerator gen) |
void |
writePrologLinefeed(org.codehaus.stax2.XMLStreamWriter2 sw)
Method for trying to write a linefeed to separate entities outside of the
root element (that is, in prolog or epilog), most often called to separate
XML declaration from the root element.
|
void |
writeRootValueSeparator(com.fasterxml.jackson.core.JsonGenerator gen) |
void |
writeStartArray(com.fasterxml.jackson.core.JsonGenerator gen) |
void |
writeStartElement(org.codehaus.stax2.XMLStreamWriter2 sw,
String nsURI,
String localName)
Method for forcibly writing a start element, without going
through Jackson generator (and thus, without updating currently
active element stack)
|
void |
writeStartObject(com.fasterxml.jackson.core.JsonGenerator gen) |
protected DefaultXmlPrettyPrinter.Indenter _arrayIndenter
protected DefaultXmlPrettyPrinter.Indenter _objectIndenter
protected boolean _spacesInObjectEntries
protected transient int _nesting
protected transient boolean _justHadStartElement
public DefaultXmlPrettyPrinter()
protected DefaultXmlPrettyPrinter(DefaultXmlPrettyPrinter base)
public void indentArraysWith(DefaultXmlPrettyPrinter.Indenter i)
public void indentObjectsWith(DefaultXmlPrettyPrinter.Indenter i)
public void spacesInObjectEntries(boolean b)
public DefaultXmlPrettyPrinter createInstance()
createInstance
in interface com.fasterxml.jackson.core.util.Instantiatable<DefaultXmlPrettyPrinter>
public void writeRootValueSeparator(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException
writeRootValueSeparator
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
public void beforeArrayValues(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException
beforeArrayValues
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
public void writeStartArray(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException
writeStartArray
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
public void writeArrayValueSeparator(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException
writeArrayValueSeparator
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
public void writeEndArray(com.fasterxml.jackson.core.JsonGenerator gen, int nrOfValues) throws IOException
writeEndArray
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
public void beforeObjectEntries(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
beforeObjectEntries
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
com.fasterxml.jackson.core.JsonGenerationException
public void writeStartObject(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException
writeStartObject
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
public void writeObjectEntrySeparator(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException
writeObjectEntrySeparator
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
public void writeObjectFieldValueSeparator(com.fasterxml.jackson.core.JsonGenerator gen) throws IOException
writeObjectFieldValueSeparator
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
public void writeEndObject(com.fasterxml.jackson.core.JsonGenerator gen, int nrOfEntries) throws IOException
writeEndObject
in interface com.fasterxml.jackson.core.PrettyPrinter
IOException
public void writeStartElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName) throws XMLStreamException
XmlPrettyPrinter
writeStartElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeEndElement(org.codehaus.stax2.XMLStreamWriter2 sw, int nrOfEntries) throws XMLStreamException
XmlPrettyPrinter
writeEndElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, String text, boolean isCData) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, char[] buffer, int offset, int len, boolean isCData) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, boolean value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, int value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, long value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, double value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, float value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, BigInteger value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, BigDecimal value) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName, byte[] data, int offset, int len) throws XMLStreamException
writeLeafElement
in interface XmlPrettyPrinter
XMLStreamException
public void writeLeafNullElement(org.codehaus.stax2.XMLStreamWriter2 sw, String nsURI, String localName) throws XMLStreamException
writeLeafNullElement
in interface XmlPrettyPrinter
XMLStreamException
public void writePrologLinefeed(org.codehaus.stax2.XMLStreamWriter2 sw) throws XMLStreamException
XmlPrettyPrinter
writePrologLinefeed
in interface XmlPrettyPrinter
XMLStreamException
Copyright © 2017 FasterXML. All rights reserved.