Javers is meant to support various persistence stores for
any kind of client's data, hence we use JSON format to serialize/deserialize client's domain objects.
Javers uses
Gson
library which provides neat and pretty JSON representation for well known Java types.
But sometimes Gson's default JSON representation isn't appropriate for your domain model.
This is often the case when dealing with Values like Date or Money.
If so, you can easily customize Javers serialization/deserialization behaviour
by providing plugins for each of your custom type.
Javers accepts several kind of plugins:
-
BasicStringTypeAdapter -
extend it if you need to represent Value as single String and don't want to deal with JSON API.
For concrete class example see LocalDateTimeTypeAdapter.
-
JsonTypeAdapter - use it if you need full control over JSON conversion
- native Gson
TypeAdapter
- native Gson
JsonSerializer
- native Gson
JsonDeserializer
Javers provides JsonTypeAdapters for some well known Values like Joda
LocalDateTime,
Joda
LocalDate, java.time.LocalDate, java.time.LocalDateTime