public abstract class AbstractObjectMapper<T> extends Object implements ObjectMapper<T>
ObjectMapper. It delegates the serialization/deserialization to a serializer/deserializer.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractObjectMapper(String rootName) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract JsonDeserializer<T> |
newDeserializer(JsonDeserializationContext ctx)
Instantiates a new deserializer
|
protected abstract JsonSerializer<T> |
newSerializer(JsonSerializationContext ctx)
Instantiates a new serializer
|
T |
read(String in)
Reads a JSON input into an object.
|
T |
read(String in,
JsonDeserializationContext ctx)
Reads a JSON input into an object.
|
String |
write(T value)
Writes an object to JSON.
|
String |
write(T value,
JsonSerializationContext ctx)
Writes an object to JSON.
|
protected AbstractObjectMapper(String rootName)
public T read(String in) throws JsonDeserializationException
ObjectReaderread in interface ObjectReader<T>in - JSON input to readJsonDeserializationException - if an exception occurs while reading the inputpublic T read(String in, JsonDeserializationContext ctx) throws JsonDeserializationException
ObjectReaderread in interface ObjectReader<T>in - JSON input to readctx - Context for the full reading processJsonDeserializationException - if an exception occurs while reading the inputprotected abstract JsonDeserializer<T> newDeserializer(JsonDeserializationContext ctx)
ctx - Context of the current deserialization processpublic String write(T value) throws JsonSerializationException
ObjectWriterwrite in interface ObjectWriter<T>value - Object to writeJsonSerializationException - if an exception occurs while writing the outputpublic String write(T value, JsonSerializationContext ctx) throws JsonSerializationException
ObjectWriterwrite in interface ObjectWriter<T>value - Object to writectx - Context for the full writing processJsonSerializationException - if an exception occurs while writing the outputprotected abstract JsonSerializer<T> newSerializer(JsonSerializationContext ctx)
ctx - Context of the current serialization processCopyright © 2013. All Rights Reserved.