M - Type of the MapK - Type of the keys inside the MapV - Type of the values inside the Mappublic class MapJsonSerializer<M extends Map<K,V>,K,V> extends JsonSerializer<M>
JsonSerializer implementation for Map.| Modifier and Type | Field and Description |
|---|---|
protected KeySerializer<K> |
keySerializer |
protected JsonSerializer<V> |
valueSerializer |
| Modifier | Constructor and Description |
|---|---|
protected |
MapJsonSerializer(KeySerializer<K> keySerializer,
JsonSerializer<V> valueSerializer) |
| Modifier and Type | Method and Description |
|---|---|
void |
doSerialize(JsonWriter writer,
M values,
JsonSerializationContext ctx)
Serializes a non-null object into JSON output.
|
static <M extends Map<K,V>,K,V> |
newInstance(KeySerializer<K> keySerializer,
JsonSerializer<V> valueSerializer) |
serializeprotected final KeySerializer<K> keySerializer
protected final JsonSerializer<V> valueSerializer
protected MapJsonSerializer(KeySerializer<K> keySerializer, JsonSerializer<V> valueSerializer)
keySerializer - KeySerializer used to serialize the keys.valueSerializer - JsonSerializer used to serialize the values.public static <M extends Map<K,V>,K,V> MapJsonSerializer<M,K,V> newInstance(KeySerializer<K> keySerializer, JsonSerializer<V> valueSerializer)
M - Type of the MapK - Type of the keys inside the MapV - Type of the values inside the MapkeySerializer - KeySerializer used to serialize the keys.valueSerializer - JsonSerializer used to serialize the values.MapJsonSerializerpublic void doSerialize(JsonWriter writer, @Nonnull M values, JsonSerializationContext ctx) throws IOException
JsonSerializerdoSerialize in class JsonSerializer<M extends Map<K,V>>writer - JsonWriter used to write the serialized JSONvalues - Object to serializectx - Context for the full serialization processIOException - if an error occurs while writing the outputCopyright © 2013. All Rights Reserved.