V
- the tpe of the deserialized valuepublic class JsonConverter<V> extends Object implements ValueConverter<V,String>
Converts values of a given type to a Json String representation and vice-versa.
Constructor and Description |
---|
JsonConverter(Class<V> deserializedValueType)
Creates a new instance that converts objects of the given type to and from Json.
|
JsonConverter(Class<V> deserializedValueType,
com.google.gson.Gson gson)
Creates a new instance that converts objects of the given type to and from Json.
|
Modifier and Type | Method and Description |
---|---|
V |
deserialize(String valueAsJson)
Deserializes the given value.
|
com.google.common.reflect.TypeToken<String> |
getSerializedValueType()
Returns a type token for the serialized value type.
|
String |
serialize(V value)
Serializes the given value.
|
public JsonConverter(Class<V> deserializedValueType)
Creates a new instance that converts objects of the given type to and from Json.
deserializedValueType
- the expected transient type of the valuepublic JsonConverter(Class<V> deserializedValueType, com.google.gson.Gson gson)
Creates a new instance that converts objects of the given type to and from Json.
deserializedValueType
- the expected transient type of the valuegson
- the gson instance responsible for the actual conversionpublic String serialize(V value)
ValueConverter
Serializes the given value.
serialize
in interface ValueConverter<V,String>
value
- the value to serializepublic V deserialize(String valueAsJson)
ValueConverter
Deserializes the given value.
deserialize
in interface ValueConverter<V,String>
valueAsJson
- the value to deserializepublic com.google.common.reflect.TypeToken<String> getSerializedValueType()
ValueConverter
Returns a type token for the serialized value type.
getSerializedValueType
in interface ValueConverter<V,String>
Copyright © 2010 - 2019 edorasware ag. All Rights Reserved.