Reputation: 1
Suppose there is a bean like this:
public class Test {
@NotBlank
@Size(max=200)
@Pattern(regexp="(\\d|\\+|-|\\?)*")
private String field;
//getters and setters
}
It is required to display all the error messages. So if both validators failed it is necessary to get both messages.
Is it possible?
Upvotes: 0
Views: 306
Reputation: 19109
It is required to display all the error messages. So if both validators failed it is necessary to get both messages.
That is the default behavior. Validator.validate
will return a set of ConstraintViolation
instances. One for each failing constraint. Only if groups or group sequences are involved there might not be all constraints evaluated.
Have you actually tried this and found an actual problem?
Upvotes: 1