With my proposal you need to define A interfaces instead of AxMxN - A being the number of separate phases in validation - and reuse the same set of interfaces for all your classes and all your fields in a given project.@GroupSequence(value={Cheap.class,Expensive.class}, ordering=PER_TARGET)
public class DomainObject {
@Size(max=50, groups=Cheap.class) // constraint 1a
@Pattern(regexp="[a-z]*", groups=Expensive.class) // constraint 1b
private String name;
@Size(max=20, groups=Cheap.class) // constraint 2a
@URL(groups=Expensive.class) // constraint 2b
private String email;
@Size(max=100, groups=Cheap.class) // constraint 3a
@Pattern(regexp="[0-9]*", groups=Expensive.class) // constraint 3b
private String password;
}From my understanding, if there is violation at size constraint of name field, email or passworld would not be validated? What I need is I want to validate all fields but for each field I would like to raise at most one violation an ordered way. For example, first size than pattern for name field.