<div dir="ltr">I agree with Matt here. <div><br></div><div>I would prefer to be consistent over dropping consistency for improved performance in some cases. </div><div><br></div><div>So +1 for allowing constraints on both fields and getters.<div><br></div><div>Christian</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-12-02 17:22 GMT+01:00 Matt Benson <span dir="ltr">&lt;<a href="mailto:mbenson@apache.org" target="_blank">mbenson@apache.org</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">As far as this goes, I agree that it makes sense to be flexible and consistent with earlier specification versions; i.e. to permit annotation of type parameters both on fields and their associated accessor methods.<div dir="auto"><br></div><div dir="auto">With regard to the mechanism used for reaching the validated contained values, my feeling is that some combination of the proposals at [1] is correct (i.e. the explicitness of the original proposal plus the aspect of your proposal to combine the extracted value with the associated path/node). It would probably also be helpful to provide an annotation-based shorthand for class developers to mark the extracted elements of custom container types without having to write an extractor implementation (which ties into my otherwise clueless response on an earlier thread ;) ). </div><div dir="auto"><br></div><div dir="auto">Matt</div><div dir="auto"><br></div><div dir="auto">1.<a href="http://beanvalidation.org/proposals/BVAL-508/" target="_blank">http://beanvalidation.org/<wbr>proposals/BVAL-508/</a></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Dec 2, 2016 9:20 AM, &quot;Gunnar Morling&quot; &lt;<a href="mailto:gunnar@hibernate.org" target="_blank">gunnar@hibernate.org</a>&gt; wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi,<div><br></div><div>As you may have seen, Emmanuel started a survey on how people would like to use type-level constraints in Bean Validation: <a href="http://beanvalidation.org/news/2016/11/23/survey-constraints-and-parameterized-type/" target="_blank">http://beanvalidat<wbr>ion.org/news/2016/11/23/<wbr>survey-constraints-and-paramet<wbr>erized-type/</a></div><div><br></div><div>While we are waiting for some more replies to that one, I started with a PoC implementation of the value extractor idea in the reference implementation in order to get a better feeling for it, it&#39;s limitations, open questions etc.: <a href="https://github.com/hibernate/hibernate-validator/pull/592" target="_blank">https://github.com/hibernate/h<wbr>ibernate-validator/pull/592</a></div><div><br></div><div>One thing we started to wonder is whether it should be allowed to put type-level constraints to a field *and* the corresponding property getter at the same time:</div><div><br></div><div>    private List&lt;@NotBlank String&gt; strings;</div><div><br></div><div>    public List&lt;@Pattern(regexp=&quot;...&quot;) String&gt; getStrings() { return strings; }</div><div><br></div><div>My first inclination was to say that it should be supported (as you can put regular constraints to a field and its getter). A challenge is how to obtain the values for constraint validation. In the spirit of BV 1 we&#39;d have to iterate the values directly from the field for evaluating the @NotBlank constraint and a second time through the getter for @Pattern validation. That&#39;s a potential performance issue of course.</div><div><br></div><div>What do others think?</div><div><br></div><div>Thanks,</div><div><br></div><div>--Gunnar</div><div><br></div></div>
<br></div></div>______________________________<wbr>_________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss<wbr>.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailma<wbr>n/listinfo/beanvalidation-dev</a><br></blockquote></div></div>
<br>______________________________<wbr>_________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.<wbr>jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/<wbr>beanvalidation-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div>Christian Kaltepoth</div><div>Blog: <a href="http://blog.kaltepoth.de/" target="_blank">http://blog.kaltepoth.de/</a></div><div>Twitter: <a href="http://twitter.com/chkal" target="_blank">http://twitter.com/chkal</a></div><div>GitHub: <a href="https://github.com/chkal" target="_blank">https://github.com/chkal</a></div><div><br></div></div>
</div>