Is it possible to validate each element of a collection, based one or more delegate validation rules? For example:
@EachElement({@Min(1), @Max(12)})
private Set<Integer> monthNumbers;
Take a look at validator-collection, with this library is very easy to use any Constraint Annotation on a collection of simple types.
@EachMin(1)
@EachMax(12)
private Set<Integer> monthNumbers;
Also see https://stackoverflow.com/a/16023061/2217862.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With