public final class NullStructureWriter extends java.lang.Object implements StructureWriter
Modifier and Type | Method and Description |
---|---|
void |
beginStructure(java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
a structure itself. |
boolean |
booleanValue(boolean value,
java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
a value. |
boolean |
doubleValue(double value,
java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
a value. |
boolean |
endStructure(java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
an end structure. |
java.lang.String |
getIdentifier()
Returns
null for no identifier. |
static NullStructureWriter |
getInstance()
Factory method for
NullStructureWriter . |
char |
getStructureType()
Returns
'i' to indicate the initial structure. |
boolean |
jsonAppendableValue(JSONAppendable value,
java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
a value. |
boolean |
jsonStringValue(JSONString value,
java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
a value. |
void |
key(java.lang.String key,
java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
a key. |
boolean |
longValue(long value,
java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
a value. |
boolean |
nullValue(java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
a value. |
boolean |
simpleValue(java.lang.Object value,
java.lang.Appendable writer)
Throws a
JSONException to indicate this writer can't write
a value. |
void |
subValue(java.lang.Appendable writer)
This method does nothing itself, but allows a sub-structure to be
written.
|
public static NullStructureWriter getInstance()
NullStructureWriter
. Returns a singleton
instance.NullStructureWriter
public void beginStructure(java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
a structure itself.beginStructure
in interface StructureWriter
writer
- the Appendable to write any beginning structure contentJSONException
- no structure can be written by this writerpublic void key(java.lang.String key, java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
a key.key
in interface StructureWriter
key
- the key to be writtenwriter
- the Appendable to write the keyJSONException
- no key can be written by this writerpublic void subValue(java.lang.Appendable writer)
subValue
in interface StructureWriter
writer
- the Appendable to write any delimiters or separatorspublic boolean simpleValue(java.lang.Object value, java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
a value.simpleValue
in interface StructureWriter
value
- the value to be writtenwriter
- the Appendable to which the JSON value will be writtentrue
to indicate JSON writing has been completed, and
no more content may be written, otherwise false
to indicate
more JSON data may be writtenJSONException
- a value cannot be written by this writerWriterUtil.isSimpleValue(Object)
public boolean jsonStringValue(JSONString value, java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
a value.jsonStringValue
in interface StructureWriter
value
- the value to be writtenwriter
- the Appendable to which the JSON value will be writtentrue
to indicate JSON writing has been completed, and
no more content may be written, otherwise false
to indicate
more JSON data may be writtenJSONException
- a value cannot be written by this writerpublic boolean jsonAppendableValue(JSONAppendable value, java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
a value.jsonAppendableValue
in interface StructureWriter
value
- the value to be writtenwriter
- the Appendable to which the JSON value will be writtentrue
to indicate JSON writing has been completed, and
no more content may be written, otherwise false
to indicate
more JSON data may be writtenJSONException
- a value cannot be written by this writerpublic boolean nullValue(java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
a value.nullValue
in interface StructureWriter
writer
- the Appendable to which the JSON value will be writtentrue
to indicate JSON writing has been completed, and
no more content may be written, otherwise false
to indicate
more JSON data may be writtenJSONException
- a value cannot be written by this writerpublic boolean booleanValue(boolean value, java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
a value.booleanValue
in interface StructureWriter
value
- the value to be writtenwriter
- the Appendable to which the JSON value will be writtentrue
to indicate JSON writing has been completed, and
no more content may be written, otherwise false
to indicate
more JSON data may be writtenJSONException
- a value cannot be written by this writerpublic boolean doubleValue(double value, java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
a value.doubleValue
in interface StructureWriter
value
- the value to be writtenwriter
- the Appendable to which the JSON value will be writtentrue
to indicate JSON writing has been completed, and
no more content may be written, otherwise false
to indicate
more JSON data may be writtenJSONException
- a value cannot be written by this writerpublic boolean longValue(long value, java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
a value.longValue
in interface StructureWriter
value
- the value to be writtenwriter
- the Appendable to which the JSON value will be writtentrue
to indicate JSON writing has been completed, and
no more content may be written, otherwise false
to indicate
more JSON data may be writtenJSONException
- a value cannot be written by this writerpublic boolean endStructure(java.lang.Appendable writer) throws JSONException
JSONException
to indicate this writer can't write
an end structure.endStructure
in interface StructureWriter
writer
- the Appendable to write any end structure contenttrue
to indicate JSON writing has been completed, and
no more content may be written, otherwise false
to indicate
more JSON data may be writtenJSONException
- no end structure can be written by this writerpublic java.lang.String getIdentifier()
null
for no identifier.getIdentifier
in interface StructureIdentifier
null
JSONPointerUtils.toJSONPointer(Iterable)
public char getStructureType()
'i'
to indicate the initial structure.getStructureType
in interface StructureWriter