The rules have been discussed here.
|
Validator exists for wrapper
|
Validator exists for wrapped value
|
Unwrapper exists
|
Example
|
Desirable result
|
1
|
–
|
–
|
–
|
–
|
Declaration error
|
2
|
–
|
–
|
x
|
@Future Optional<Integer> myInt;
|
Declaration error
|
3
|
–
|
x
|
–
|
@Min(3) Holder<Integer> myHolder;
|
Declaration error
|
4
|
–
|
x
|
x
|
@Min(3) Optional<Integer> myInt; Optional<@Email String>;
|
Validate wrapped value
|
5
|
x
|
–
|
–
|
@ValidHolder Holder myHolder;
|
Validate wrapper
|
6
|
x
|
–
|
x
|
@ValidHolder Holder myHolder;
|
Validate wrapper
|
7
|
x
|
x
|
|
@NotNull Holder myHolder;
|
Validate wrapper
|
8
|
x
|
x
|
x
|
@NotNull IntegerProperty myInt;
|
Declaration error; needs to be resolved by making intent explicit (which could be achieved by adding a boolean flag to @UnwrapValidatedValue)
|
|