Anyone know how to write custom data persister for Guava's Optional<Double>
?
So it could be possible to directly use in entity the code:
@DatabaseField(columnName = "myField")
Optional<Double> myField;
After initial attemps I found a few tricky points. Eg: registering Optional<Double>
in mapper - seems that types dictionary flattens it to just Optional
.
Here is my implementation which ONLY persit to / read from DB.
And DOESN'T handle: arguments in statements, global type registering.
Before use it's worth to read why not to use Optional as object's fied.
Use case:
Persister: