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)
Constructor for AbstractObjectMapper.
|
| Modifier and Type | Method and Description |
|---|---|
JsonDeserializer<T> |
getDeserializer()
getDeserializer.
|
JsonSerializer<T> |
getSerializer()
getSerializer.
|
protected abstract JsonDeserializer<T> |
newDeserializer()
Instantiates a new deserializer
|
protected abstract JsonSerializer<?> |
newSerializer()
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.
|
T[] |
readArray(String input,
ArrayJsonDeserializer.ArrayCreator<T> arrayCreator)
Reads a JSON input into an array object.
|
T[] |
readArray(String input,
JsonDeserializationContext ctx,
ArrayJsonDeserializer.ArrayCreator<T> arrayCreator)
Reads a JSON input into an array object.
|
String |
write(T value)
Writes an object to JSON.
|
String |
write(T value,
JsonSerializationContext ctx)
Writes an object to JSON.
|
public T read(String in) throws JsonDeserializationException
read 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
read in interface ObjectReader<T>in - JSON input to readctx - Context for the full reading processJsonDeserializationException - if an exception occurs while reading the inputpublic T[] readArray(String input, ArrayJsonDeserializer.ArrayCreator<T> arrayCreator) throws JsonDeserializationException
readArray in interface ObjectReader<T>input - JSON input to readarrayCreator - Creator for initializing new instance of an array of specific lengthJsonDeserializationException - if an exception occurs while reading the inputpublic T[] readArray(String input, JsonDeserializationContext ctx, ArrayJsonDeserializer.ArrayCreator<T> arrayCreator) throws JsonDeserializationException
readArray in interface ObjectReader<T>input - JSON input to readctx - Context for the full reading processarrayCreator - Creator for initializing new instance of an array of specific lengthJsonDeserializationException - if an exception occurs while reading the inputpublic JsonDeserializer<T> getDeserializer()
getDeserializer.
Getter for the field deserializer.
getDeserializer in interface ObjectReader<T>JsonDeserializer object.protected abstract JsonDeserializer<T> newDeserializer()
public String write(T value) throws JsonSerializationException
write in interface ObjectWriter<T>value - Object to writeJsonSerializationException - if an exception occurs while writing the outputpublic String write(T value, JsonSerializationContext ctx) throws JsonSerializationException
write in interface ObjectWriter<T>value - Object to writectx - Context for the full writing processString object.JsonSerializationException - if an exception occurs while writing the outputpublic JsonSerializer<T> getSerializer()
getSerializer.
Getter for the field serializer.
getSerializer in interface ObjectWriter<T>JsonSerializer object.protected abstract JsonSerializer<?> newSerializer()
Copyright © 2020. All rights reserved.