given the following two Constraints
@NotNull
@Pattern (pattern="foobar")
private String myFooBarMember;
Is there a possibility, if the first one matched (=returned an error) (@NotNull) to not evaluate the second one (@Pattern)? or does JSR303 always evaluate all Constraints? If there is a possibility to not evaluate the second after a first match, please state how this can be done.
Thank you very much!
Well, I’m not a JSR 303 specialist, but I’ve found the following excerpts from the 1.0 FR:
and:
So from the latter, I’d say that by default all validators will be executed.
From the former, I’d say that this (constraint composition) would be one way to achieve what you want. Although it might (and probably is) dependent on the Bean Validation implementor, so you’d need to read some proprietary docs.