public interface JsonWriter
Wraps an underlying JsonGenerator taking into account null suppression and exposing isIncludeEmpty() etc.
-
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.core.JsonGenerator
gen()
Return the Jackson core JsonGenerator.boolean
Return true if empty collections should be included in the JSON output.boolean
Return true if null values should be included in JSON output.void
writeBinary
(InputStream is, int length) Write a binary field.void
writeBinaryField
(String name, byte[] value) Write a binary field.void
writeBoolean
(boolean value) Write a boolean value (typically inside a list).void
writeBooleanField
(String name, boolean value) Write a boolean field.void
Write a array end.void
Write a object end.void
writeFieldName
(String name) Write the field name.void
Write a null value.void
writeNullField
(String name) Write a null value taking into account null value suppression.void
writeNumber
(double value) Write a double value.void
writeNumber
(int value) Write a int value (typically inside a list).void
writeNumber
(long value) Write a long value (typically inside a list).void
writeNumber
(BigDecimal value) Write a BigDecimal value (typically inside a list).void
writeNumberField
(String name, double value) Write a number field.void
writeNumberField
(String name, float value) Write a number field.void
writeNumberField
(String name, int value) Write a number field.void
writeNumberField
(String name, long value) Write a number field.void
writeNumberField
(String name, short value) Write a number field.void
writeNumberField
(String name, BigDecimal value) Write a number field.void
Method that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such).void
writeRawValue
(String text) Method that will force generator to copy input text verbatim without any modifications, but assuming it must constitute a single legal JSON value (number, string, boolean, null, Array or List).void
Write a array start.void
writeStartArray
(String key) Write a field name followed by array start.void
Write a object start.void
writeStartObject
(String key) Write a field name followed by object start.void
writeString
(String value) Write a string value (typically inside a list).void
writeStringField
(String name, String value) Write a sting field.
-
Method Details
-
gen
com.fasterxml.jackson.core.JsonGenerator gen()Return the Jackson core JsonGenerator. -
isIncludeNull
boolean isIncludeNull()Return true if null values should be included in JSON output. -
isIncludeEmpty
boolean isIncludeEmpty()Return true if empty collections should be included in the JSON output. -
writeStartObject
Write a field name followed by object start. -
writeStartObject
void writeStartObject()Write a object start. -
writeEndObject
void writeEndObject()Write a object end. -
writeStartArray
Write a field name followed by array start. -
writeStartArray
void writeStartArray()Write a array start. -
writeEndArray
void writeEndArray()Write a array end. -
writeFieldName
Write the field name. -
writeNullField
Write a null value taking into account null value suppression. -
writeNumberField
Write a number field. -
writeNumberField
Write a number field. -
writeNumberField
Write a number field. -
writeNumberField
Write a number field. -
writeNumberField
Write a number field. -
writeNumberField
Write a number field. -
writeStringField
Write a sting field. -
writeBinary
Write a binary field. -
writeBinaryField
Write a binary field. -
writeBooleanField
Write a boolean field. -
writeBoolean
void writeBoolean(boolean value) Write a boolean value (typically inside a list). -
writeString
Write a string value (typically inside a list). -
writeNumber
void writeNumber(int value) Write a int value (typically inside a list). -
writeNumber
void writeNumber(long value) Write a long value (typically inside a list). -
writeNumber
void writeNumber(double value) Write a double value. -
writeNumber
Write a BigDecimal value (typically inside a list). -
writeNull
void writeNull()Write a null value. -
writeRaw
Method that will force generator to copy input text verbatim with no modifications (including that no escaping is done and no separators are added even if context [array, object] would otherwise require such). If such separators are desired, usewriteRawValue(String)
instead. -
writeRawValue
Method that will force generator to copy input text verbatim without any modifications, but assuming it must constitute a single legal JSON value (number, string, boolean, null, Array or List). Assuming this, proper separators are added if and as needed (comma or colon), and generator state updated to reflect this.
-