public class JqPlotJsonMapHierarchicalWriter extends Object implements com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter
| Modifier and Type | Class and Description |
|---|---|
class |
JqPlotJsonMapHierarchicalWriter.Node |
| Modifier and Type | Field and Description |
|---|---|
static int |
DROP_ROOT_MODE
DROP_ROOT_MODE drops the JSON root node.
|
static int |
STRICT_MODE
STRICT_MODE prevents invalid JSON for single value objects when dropping the root.
|
| Constructor and Description |
|---|
JqPlotJsonMapHierarchicalWriter(Writer writer) |
JqPlotJsonMapHierarchicalWriter(Writer writer,
char[] lineIndenter) |
JqPlotJsonMapHierarchicalWriter(Writer writer,
char[] lineIndenter,
String newLine) |
JqPlotJsonMapHierarchicalWriter(Writer writer,
char[] lineIndenter,
String newLine,
int mode) |
JqPlotJsonMapHierarchicalWriter(Writer writer,
int mode)
Create a JsonWriter where the writer mode can be chosen.
|
JqPlotJsonMapHierarchicalWriter(Writer writer,
String lineIndenter) |
JqPlotJsonMapHierarchicalWriter(Writer writer,
String lineIndenter,
String newLine) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String key,
String value) |
void |
close() |
void |
endNode() |
protected void |
endOfLine() |
void |
flush() |
void |
setValue(String text) |
void |
startNode(String name)
Deprecated.
since 1.2, use startNode(String name, Class clazz) instead.
|
void |
startNode(String name,
Class clazz) |
com.thoughtworks.xstream.io.HierarchicalStreamWriter |
underlyingWriter() |
protected void |
writeAttributeValue(com.thoughtworks.xstream.core.util.QuickWriter writer,
String text) |
protected void |
writeText(com.thoughtworks.xstream.core.util.QuickWriter writer,
String text) |
public static final int DROP_ROOT_MODE
{ "person": {
"name": "Joe"
}}
will be written without root simply as
{
"name": "Joe"
}
Without a root node, the top level element might now also be an array. However, it is
possible to generate invalid JSON unless STRICT_MODE is also set.public static final int STRICT_MODE
DROP_ROOT_MODE. An object with a
single value as first node i.e.
{ "name": "Joe" }
is simply written as
"Joe"However, this is no longer valid JSON. Therefore you can activate
STRICT_MODE
and a ConversionException is thrown instead.public JqPlotJsonMapHierarchicalWriter(Writer writer, char[] lineIndenter, String newLine)
writer - WriterlineIndenter - char arraynewLine - Stringpublic JqPlotJsonMapHierarchicalWriter(Writer writer, char[] lineIndenter)
writer - WriterlineIndenter - char arraypublic JqPlotJsonMapHierarchicalWriter(Writer writer, String lineIndenter, String newLine)
writer - WriterlineIndenter - StringnewLine - String
]public JqPlotJsonMapHierarchicalWriter(Writer writer, String lineIndenter)
writer - WriterlineIndenter - Stringpublic JqPlotJsonMapHierarchicalWriter(Writer writer)
writer - Writerpublic JqPlotJsonMapHierarchicalWriter(Writer writer, char[] lineIndenter, String newLine, int mode)
writer - WriterlineIndenter - array of charnewLine - new linemode - modepublic JqPlotJsonMapHierarchicalWriter(Writer writer, int mode)
DROP_ROOT_MODE: drop the root nodeSTRICT_MODE: do not throw ConversionException, if writer should
generate invalid JSONwriter - the Writer where the JSON is written tomode - the JsonWriter modepublic void startNode(String name)
startNode in interface com.thoughtworks.xstream.io.HierarchicalStreamWriterpublic void startNode(String name, Class clazz)
startNode in interface com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWritername - name of nodeclazz - type of classpublic void setValue(String text)
setValue in interface com.thoughtworks.xstream.io.HierarchicalStreamWritertext - Textpublic void addAttribute(String key, String value)
addAttribute in interface com.thoughtworks.xstream.io.HierarchicalStreamWriterkey - keyvalue - valueprotected void writeAttributeValue(com.thoughtworks.xstream.core.util.QuickWriter writer,
String text)
writer - writertext - textprotected void writeText(com.thoughtworks.xstream.core.util.QuickWriter writer,
String text)
writer - writertext - textpublic void endNode()
endNode in interface com.thoughtworks.xstream.io.HierarchicalStreamWriterprotected void endOfLine()
public void flush()
flush in interface com.thoughtworks.xstream.io.HierarchicalStreamWriterpublic void close()
close in interface com.thoughtworks.xstream.io.HierarchicalStreamWriterpublic com.thoughtworks.xstream.io.HierarchicalStreamWriter underlyingWriter()
underlyingWriter in interface com.thoughtworks.xstream.io.HierarchicalStreamWriterCopyright © 2025. All rights reserved.