Package io.avaje.jsonb.spi
Class DelegateJsonWriter
- java.lang.Object
-
- io.avaje.jsonb.spi.DelegateJsonWriter
-
- All Implemented Interfaces:
JsonWriter,Closeable,Flushable,AutoCloseable
public abstract class DelegateJsonWriter extends Object implements JsonWriter
Provides a delegating JsonWriter.
-
-
Constructor Summary
Constructors Constructor Description DelegateJsonWriter(JsonWriter delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallNames(PropertyNames names)Set the property names that will be used for all json generation.voidbeginArray()Write array begin.voidbeginObject()Write object begin.voidclose()Close the writer.voidemptyArray()Write empty array.voidendArray()Write array end.voidendObject()Write object end.voidflush()Flush the writer.voidjsonValue(Object value)Write a value that could be any value.voidname(int position)Set the next property name to write by position.voidname(String name)Set the next property name to write.voidnames(PropertyNames names)Set the current property names.voidnullValue()Write null value.Stringpath()Return the current path.voidpretty(boolean pretty)Set tp true to output json in pretty format.booleanserializeEmpty()Return true if empty collections should be serialised.voidserializeEmpty(boolean serializeEmpty)Set to serialise empty collections or not.booleanserializeNulls()Return true if null values should be serialised.voidserializeNulls(boolean serializeNulls)Set to serialise null values or not.voidvalue(boolean value)Write a boolean value.voidvalue(double value)Write a double value.voidvalue(int value)Write an int value.voidvalue(long value)Write a long value.voidvalue(Boolean value)Write a Boolean value.voidvalue(Double value)Write a Double value.voidvalue(Integer value)Write an Integer value.voidvalue(Long value)Write a Long value.voidvalue(String value)Write a string value.voidvalue(BigDecimal value)Write a BigDecimal value.voidvalue(BigInteger value)Write a BigInteger value.voidwriteNewLine()Write raw content.
-
-
-
Constructor Detail
-
DelegateJsonWriter
public DelegateJsonWriter(JsonWriter delegate)
-
-
Method Detail
-
serializeNulls
public final void serializeNulls(boolean serializeNulls)
Description copied from interface:JsonWriterSet to serialise null values or not.- Specified by:
serializeNullsin interfaceJsonWriter
-
serializeNulls
public final boolean serializeNulls()
Description copied from interface:JsonWriterReturn true if null values should be serialised.- Specified by:
serializeNullsin interfaceJsonWriter
-
serializeEmpty
public final boolean serializeEmpty()
Description copied from interface:JsonWriterReturn true if empty collections should be serialised.- Specified by:
serializeEmptyin interfaceJsonWriter
-
serializeEmpty
public final void serializeEmpty(boolean serializeEmpty)
Description copied from interface:JsonWriterSet to serialise empty collections or not.- Specified by:
serializeEmptyin interfaceJsonWriter
-
pretty
public final void pretty(boolean pretty)
Description copied from interface:JsonWriterSet tp true to output json in pretty format.- Specified by:
prettyin interfaceJsonWriter
-
path
public final String path()
Description copied from interface:JsonWriterReturn the current path.- Specified by:
pathin interfaceJsonWriter
-
beginArray
public final void beginArray()
Description copied from interface:JsonWriterWrite array begin.- Specified by:
beginArrayin interfaceJsonWriter
-
endArray
public final void endArray()
Description copied from interface:JsonWriterWrite array end.- Specified by:
endArrayin interfaceJsonWriter
-
emptyArray
public final void emptyArray()
Description copied from interface:JsonWriterWrite empty array.- Specified by:
emptyArrayin interfaceJsonWriter
-
beginObject
public final void beginObject()
Description copied from interface:JsonWriterWrite object begin.- Specified by:
beginObjectin interfaceJsonWriter
-
endObject
public final void endObject()
Description copied from interface:JsonWriterWrite object end.- Specified by:
endObjectin interfaceJsonWriter
-
name
public final void name(String name)
Description copied from interface:JsonWriterSet the next property name to write.This is generally less efficient than using
JsonWriter.names(PropertyNames)andJsonWriter.name(int).- Specified by:
namein interfaceJsonWriter
-
allNames
public void allNames(PropertyNames names)
Description copied from interface:JsonWriterSet the property names that will be used for all json generation.These names should be used for all json generation for this generator and set once rather than set per object via
JsonWriter.names(PropertyNames).This is used by view json generation where all the names are known at the point when the view is created (a sort of flattened nested tree).
- Specified by:
allNamesin interfaceJsonWriter
-
names
public final void names(PropertyNames names)
Description copied from interface:JsonWriterSet the current property names.This is expected to be called per object after each call to
JsonWriter.beginObject().- Specified by:
namesin interfaceJsonWriter
-
name
public final void name(int position)
Description copied from interface:JsonWriterSet the next property name to write by position. This uses the already encoded name values of PropertyNames.- Specified by:
namein interfaceJsonWriter
-
nullValue
public final void nullValue()
Description copied from interface:JsonWriterWrite null value.- Specified by:
nullValuein interfaceJsonWriter
-
value
public final void value(String value)
Description copied from interface:JsonWriterWrite a string value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(boolean value)
Description copied from interface:JsonWriterWrite a boolean value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(int value)
Description copied from interface:JsonWriterWrite an int value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(long value)
Description copied from interface:JsonWriterWrite a long value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(double value)
Description copied from interface:JsonWriterWrite a double value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(Boolean value)
Description copied from interface:JsonWriterWrite a Boolean value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(Integer value)
Description copied from interface:JsonWriterWrite an Integer value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(Long value)
Description copied from interface:JsonWriterWrite a Long value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(Double value)
Description copied from interface:JsonWriterWrite a Double value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(BigDecimal value)
Description copied from interface:JsonWriterWrite a BigDecimal value.- Specified by:
valuein interfaceJsonWriter
-
value
public final void value(BigInteger value)
Description copied from interface:JsonWriterWrite a BigInteger value.- Specified by:
valuein interfaceJsonWriter
-
jsonValue
public final void jsonValue(Object value)
Description copied from interface:JsonWriterWrite a value that could be any value.- Specified by:
jsonValuein interfaceJsonWriter
-
writeNewLine
public final void writeNewLine()
Description copied from interface:JsonWriterWrite raw content. This is typically used to write new line characters forx-json-streamcontent.- Specified by:
writeNewLinein interfaceJsonWriter
-
flush
public final void flush()
Description copied from interface:JsonWriterFlush the writer.- Specified by:
flushin interfaceFlushable- Specified by:
flushin interfaceJsonWriter
-
close
public void close()
Description copied from interface:JsonWriterClose the writer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceJsonWriter
-
-