public interface JSONWriter extends Closeable
This class is required in order to handle the case when a JsonGenerator
implementation is not available. Aeson uses this interface so that it is not coupled
directly the JsonGenerator
and can revert back to its internal JSON writer.
The methods are intendedly similar to the JsonGenerator
interface.
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this object and frees any resources associated with it.
|
JSONWriter |
end()
Writes the end of the current context.
|
JSONWriter |
property(String name,
boolean value)
Writes a JSON name/boolean value pair in the current object context.
|
JSONWriter |
property(String name,
double value)
Writes a JSON name/boolean value pair in the current object context.
|
JSONWriter |
property(String name,
long value)
Writes a JSON name/boolean value pair in the current object context.
|
JSONWriter |
property(String name,
String value)
Writes a JSON name/boolean value pair in the current object context.
|
JSONWriter |
startArray()
Start writing a JSON array in the context of an array.
|
JSONWriter |
startArray(String name)
Start writing a JSON array in the context of an object.
|
JSONWriter |
startObject()
Start writing a JSON object in the context of an array.
|
JSONWriter |
startObject(String name)
Start writing a JSON object in the context of an object.
|
JSONWriter |
value(boolean number)
Writes the specified value as a JSON value within the current array context.
|
JSONWriter |
value(double number)
Writes the specified value as a JSON value within the current array context.
|
JSONWriter |
value(long number)
Writes the specified value as a JSON value within the current array context.
|
JSONWriter |
value(String number)
Writes the specified value as a JSON value within the current array context.
|
JSONWriter |
writeNull()
Start writing a JSON object in the context of an array.
|
JSONWriter |
writeNull(String name)
Start writing a JSON object in the context of an array.
|
JSONWriter |
writeNull2()
Writes a
null value. |
JSONWriter |
writeNull2(String name)
Writes a value-pair which value is
null . |
JSONWriter startArray(String name)
name
- The name of the arrayJSONWriter startArray()
JSONWriter startObject(String name)
name
- The name of the arrayJSONWriter startObject()
JSONWriter end()
JSONWriter writeNull(String name)
name
- a name in the JSON name/value pair to be written in current JSON objectJSONWriter writeNull()
JSONWriter writeNull2(String name)
null
.name
- a name in the JSON name/value pair to be written in current JSON objectJSONWriter writeNull2()
null
value.JSONWriter value(double number)
number
- the value to write.JSONWriter value(long number)
number
- the value to write.JSONWriter value(String number)
number
- the value to write.JSONWriter value(boolean number)
number
- the value to write.JSONWriter property(String name, String value)
name
- a name in the JSON name/value pair to be written in current JSON objectvalue
- a value in the JSON name/value pair to be written in current JSON objectJSONWriter property(String name, boolean value)
name
- a name in the JSON name/value pair to be written in current JSON objectvalue
- a value in the JSON name/value pair to be written in current JSON objectJSONWriter property(String name, double value)
name
- a name in the JSON name/value pair to be written in current JSON objectvalue
- a value in the JSON name/value pair to be written in current JSON objectJSONWriter property(String name, long value)
name
- a name in the JSON name/value pair to be written in current JSON objectvalue
- a value in the JSON name/value pair to be written in current JSON objectvoid close()
close
in interface AutoCloseable
close
in interface Closeable
Copyright © 2016 Allette Systems. All rights reserved.