public abstract class JsonSerializer<T> extends Object
| Constructor and Description |
|---|
JsonSerializer() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
doSerialize(JsonWriter writer,
T value,
JsonSerializationContext ctx,
JsonSerializerParameters params)
Serializes a non-null object into JSON output.
|
protected boolean |
isAbsent(T value)
isAbsent.
|
protected boolean |
isDefault(T value)
isDefault.
|
protected boolean |
isEmpty(T value)
isEmpty.
|
void |
serialize(JsonWriter writer,
T value,
JsonSerializationContext ctx)
Serializes an object into JSON output.
|
void |
serialize(JsonWriter writer,
T value,
JsonSerializationContext ctx,
JsonSerializerParameters params)
Serializes an object into JSON output.
|
void |
serialize(JsonWriter writer,
T value,
JsonSerializationContext ctx,
JsonSerializerParameters params,
boolean isMapValue)
Serializes an object into JSON output.
|
protected void |
serializeNullValue(JsonWriter writer,
JsonSerializationContext ctx,
JsonSerializerParameters params)
Serialize the null value.
|
public void serialize(JsonWriter writer, T value, JsonSerializationContext ctx) throws JsonSerializationException
writer - JsonWriter used to write the serialized JSONvalue - Object to serializectx - Context for the full serialization processJsonSerializationException - if an error occurs during the serializationpublic void serialize(JsonWriter writer, T value, JsonSerializationContext ctx, JsonSerializerParameters params) throws JsonSerializationException
writer - JsonWriter used to write the serialized JSONvalue - Object to serializectx - Context for the full serialization processparams - Parameters for this serializationJsonSerializationException - if an error occurs during the serializationpublic void serialize(JsonWriter writer, T value, JsonSerializationContext ctx, JsonSerializerParameters params, boolean isMapValue) throws JsonSerializationException
writer - JsonWriter used to write the serialized JSONvalue - Object to serializectx - Context for the full serialization processparams - Parameters for this serializationisMapValue - indicate if you're serializing a Map valueJsonSerializationException - if an error occurs during the serializationprotected void serializeNullValue(JsonWriter writer, JsonSerializationContext ctx, JsonSerializerParameters params)
writer - JsonWriter used to write the serialized JSONctx - Context for the full serialization processparams - Parameters for this serializationprotected boolean isDefault(T value)
isDefault.
value - the valueprotected boolean isEmpty(T value)
isEmpty.
value - the valueprotected boolean isAbsent(T value)
isAbsent.
value - the valueprotected abstract void doSerialize(JsonWriter writer, T value, JsonSerializationContext ctx, JsonSerializerParameters params)
writer - JsonWriter used to write the serialized JSONvalue - Object to serializectx - Context for the full serialization processparams - Parameters for this serializationCopyright © 2019. All rights reserved.