<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 4 janv. 2012, at 22:54, Cemo wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<div><br></div><div>Emmanuel, I can really see your points about&nbsp;<span style="background-color:rgb(255,255,255)">ordering numbers (the salience approach). I think that you are totally right. But in terms of usability declaring again and again interfaces are killing usability. At your example there is a still need for declaring them. And also at the order of the &nbsp; &nbsp; constraints are can not be reached by reflection.&nbsp;</span></div></blockquote><div><br></div><div>You mean by Java reflection? Yes it can. From the DomainObject class you can reach the GroupSequence&nbsp;annotation. That's how a Bean Validation provider does it anyways.</div><div>Why do you need to access the order by the way?</div><br><blockquote type="cite">

<div><span style="background-color:rgb(255,255,255)"><br></span></div><div><span style="background-color:rgb(255,255,255)">At this point I believe that defining order explicitly is the best. Maybe like&nbsp;</span>GroupSequence we can use ConstraintSequence whose target type "Field, Method, Type" as opposite to GroupSequence whose target type "Type". GroupSequence implies group related operations as expected, whereas ConstraintSequence implies ConstraintSequence. For me really it makes sense.</div></blockquote><div><br></div><div>What would @ConstraintSequence look like? From what you are saying, it would have the notion of group in there so I imaging that would need to be either global or applied on every target.</div><div><br></div><div>```<br>public class DomainObject {<br><br>&nbsp; &nbsp; &nbsp; &nbsp;@ConstraintSequence(value={PER_TARGET))</div><div>&nbsp; &nbsp; &nbsp; &nbsp;@Size(max=50, ordering=1) // constraint 1a<br>&nbsp; &nbsp; &nbsp; &nbsp;@Pattern(regexp="[a-z]*", ordering=2) &nbsp;// constraint 1b<br>&nbsp; &nbsp; &nbsp; &nbsp;private String name;<br><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp;@ConstraintSequence(value={PER_TARGET))<br>&nbsp; &nbsp; &nbsp; &nbsp;@Size(max=20,&nbsp;&nbsp;ordering=1) // constraint 2a<br>&nbsp; &nbsp; &nbsp; &nbsp;@URL(ordering=2) // constraint 2b<br>&nbsp; &nbsp; &nbsp; &nbsp;private String email;<br><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp;@ConstraintSequence(value={PER_TARGET))<br>&nbsp; &nbsp; &nbsp; &nbsp;@Size(max=100, ordering=1) // constraint 3a<br>&nbsp; &nbsp; &nbsp; &nbsp;@Pattern(regexp="[0-9]*", ordering=2) // constraint 3b</div><div>&nbsp; &nbsp; &nbsp; &nbsp;private String password;<br>}<br>```</div><div><br></div><div>Is that what you had in mind?</div><br><blockquote type="cite">

<div><br></div><div>For my use case I just want to not declaring again and again interfaces. For M class and N field I have to declare (M) x (N) x (Annotation Count) Interface. And without declaring interface I would like to have short circuit feature.&nbsp;</div></blockquote><div><br></div><div>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.</div><br><blockquote type="cite">

<div><br></div><div>Thanks &nbsp; &nbsp;</div><div><span style="background-color:rgb(255,255,255)"><br></span></div><div><br></div><div><br></div><div><br></div><div><br></div><div>But there is another point too. Groups are used also for partial validation. And groups are really implies this partial validation with its name very good.<br>

<br><div class="gmail_quote">On 4 January 2012 16:29,  <span dir="ltr">&lt;<a href="mailto:beanvalidation-dev-request@lists.jboss.org">beanvalidation-dev-request@lists.jboss.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">

<div id=":2b">Message: 3<br>
Date: Wed, 4 Jan 2012 15:25:10 +0100<br>
From: Emmanuel Bernard &lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt;<br>
Subject: Re: [bv-dev] Ordered Validation (practically)<br>
To: beanvalidation-dev &nbsp;List &lt;<a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a>&gt;<br>
Message-ID: &lt;<a href="mailto:9B5F338F-1682-438B-8270-A2A0E9DADE81@hibernate.org">9B5F338F-1682-438B-8270-A2A0E9DADE81@hibernate.org</a>&gt;<br>
Content-Type: text/plain; charset=us-ascii<br>
<br>
I have what I think is a nice solution for BVAL-248 and for the uses case Cemo has<br>
<br>
The issue in this case is that you want the logic of group sequence but only per target (property, class, annotation).<br>
<br>
We can dot he following for that reusing HV-462's example<br>
<br>
```<br>
interface Cheap {}<br>
interface Expensive {}<br>
<br>
@GroupSequence(value={Cheap.class,Expensive.class}, ordering=PER_TARGET)<br>
public class DomainObject {<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;@Size(max=50, groups=Cheap.class) // constraint 1a<br>
 &nbsp; &nbsp; &nbsp; &nbsp;@Pattern(regexp="[a-z]*", groups=Expensive.class) &nbsp;// constraint 1b<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private String name;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;@Size(max=20, groups=Cheap.class) // constraint 2a<br>
 &nbsp; &nbsp; &nbsp; &nbsp;@URL(groups=Expensive.class) // constraint 2b<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private String email;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;@Size(max=100, groups=Cheap.class) // constraint 3a<br>
 &nbsp; &nbsp; &nbsp; &nbsp;@Pattern(regexp="[0-9]*", groups=Expensive.class) // constraint 3b<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private String password;<br>
}<br>
```<br>
<br>
The default @GroupSequence.ordering would be GLOBAL which is the current behavior.<br>
<br>
This solution is not technically as orthogonal than a true salience model but would that work for the use cases you have in mind?<br>
<br>
We can apply the same kind of solution on @ReportAsSingleViolation<br>
<br>
What do you think?<br>
<br>
Emmanuel</div></blockquote></div><br></div>
_______________________________________________<br>beanvalidation-dev mailing list<br><a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/beanvalidation-dev<br></blockquote></div><br></body></html>