[jackson-user] Custom deserializer for Optinal with defined values for Optional.empty()

2018-03-19 Thread cap5lut
Hello, I have a problem with a deserializer I am working on. At the deserializer I want to register values, which indicate that the resulting Optional should be empty. But if the value in the JSON string is null, the Optional will be null as well, else it works as expected. Here is the code

[jackson-user] Custom deserialization problem for Optional with specified values for Optional.empty()

2018-03-19 Thread cap5lut
d, and a.test will be set to null by something else, so a work around like public class A { public Optional test = Optional.empty(); } does not work either. If i run the same code against a JSON string like this: {"test":""} It is perfectly fine and a.test is an empty Optional.