T - user type, mapped to ValueType or CustomTypeBasicStringTypeAdapter, CdoSnapshotStateTypeAdapter, JsonTypeAdapterTemplatepublic 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.util.LocalDateTimeTypeAdapter.
JsonConverter| Modifier and Type | Method | 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()