T - user type, mapped to ValueType or CustomTypepublic interface JsonTypeAdapter<T>
ValueType or CustomType eligible for deserialization
should have a no-argument constructor (public or private).
Implementation shouldn't take care about nulls (nulls are handled by Gson engine)
For implementation example see org.javers.core.json.typeadapter.joda.LocalDateTimeTypeAdapter.
JsonConverter| Modifier and Type | Method and Description |
|---|---|
T |
fromJson(com.google.gson.JsonElement json,
com.google.gson.JsonDeserializationContext jsonDeserializationContext) |
java.util.List<java.lang.Class> |
getValueTypes()
Target class.
|
com.google.gson.JsonElement |
toJson(T sourceValue,
com.google.gson.JsonSerializationContext jsonSerializationContext) |
T fromJson(com.google.gson.JsonElement json, com.google.gson.JsonDeserializationContext jsonDeserializationContext)
json - not null and not JsonNulljsonDeserializationContext - use it to invoke default deserialization on the specified objectcom.google.gson.JsonElement toJson(T sourceValue, com.google.gson.JsonSerializationContext jsonSerializationContext)
sourceValue - not nulljsonSerializationContext - use it to invoke default serialization on the specified objectjava.util.List<java.lang.Class> getValueTypes()