Hi,
Given this POJO
The following class allows both Optional.empty() and null values. class X { @UnwrapValidatedValue @Min(2) Optional<Integer> foo; }
The following class neither allows Optional.empty() and null values. class X { @NotNull @UnwrapValidatedValue @Min(2) Optional<Integer> foo; }
I would like to be able to allow Optional.empty() but not allow null values. The idea is that foo could have no value, but the proper way to convey that is to use Optional.empty() but not null.
Is there a way to do that ? I also could not find the unit tests that check these kind of scenarios.
Regards, Itai
|