Message: 3
Date: Wed, 4 Jan 2012 15:25:10 +0100
From: Emmanuel Bernard <
emmanuel@hibernate.org>
Subject: Re: [bv-dev] Ordered Validation (practically)
To: beanvalidation-dev List <
beanvalidation-dev@lists.jboss.org>
Message-ID: <
9B5F338F-1682-438B-8270-A2A0E9DADE81@hibernate.org>
Content-Type: text/plain; charset=us-ascii
I have what I think is a nice solution for BVAL-248 and for the uses case Cemo has
The issue in this case is that you want the logic of group sequence but only per target (property, class, annotation).
We can dot he following for that reusing HV-462's example
```
interface Cheap {}
interface Expensive {}
@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;
}
```
The default @GroupSequence.ordering would be GLOBAL which is the current behavior.
This solution is not technically as orthogonal than a true salience model but would that work for the use cases you have in mind?
We can apply the same kind of solution on @ReportAsSingleViolation
What do you think?
Emmanuel