<div dir="ltr">&gt; <span style="font-family:arial,sans-serif;font-size:13px">two elements brings the aditional complexity of the incompatible</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">  combinations or even expected behavior when considering weird</span><br style="font-family:arial,sans-serif;font-size:13px">

<span style="font-family:arial,sans-serif;font-size:13px">  combinations.</span><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">I see your point.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">OTOH, also in the current model a user </span><span style="font-family:arial,sans-serif;font-size:13px">could specify something incompatible like { NONE, CONSTRUCTORS }. In both models we mitigate the risk for inconsistent use by</span><span style="font-family:arial,sans-serif;font-size:13px"> properly documenting the behavior, but personally I&#39;d find two separate attributes, each with clear semantics, &quot;harder&quot; to use wrong than one enum with mixed values.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Or, to put it in other words, the precedence of an enabled/disabled switch over another attribute controlling the enabled behavior seems to me more natural and intuitively understandable than the </span><span style="font-family:arial,sans-serif;font-size:13px">{ NONE, CONSTRUCTORS } case which only can be resolved by documentation.</span></div>
<div><br></div><div style>But in the end that&#39;s details, both approaches surely work.</div><div style><br></div>
<div style><span style="font-family:arial,sans-serif;font-size:13px">--Gunnar</span></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/2/15 Emmanuel Bernard <span dir="ltr">&lt;<a href="mailto:emmanuel@hibernate.org" target="_blank">emmanuel@hibernate.org</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">We discussed that be to me:<br>
- two annotations do make things more complex IMO and thus go against<br>
  the goal here. Esp with annotations with similar names<br>
- two elements brings the aditional complexity of the incompatible<br>
  combinations or even expected behavior when considering weird<br>
  combinations.<br>
<br>
I&#39;d rather live with a slightly awkward enum.<br>
<span><font color="#888888"><br>
Emmanuel<br>
</font></span><div><div><br>
On Fri 2013-02-15 15:58, Gunnar Morling wrote:<br>
&gt; I agree with what Hardy said.<br>
&gt;<br>
&gt; Alternatively we could have one annotation with two attributes:<br>
&gt;<br>
&gt; @ValidateExecutables(enabled=true/false,<br>
&gt; types=ALL|CONSTRUCTORS|GETTERS|NON_GETTERS)<br>
&gt;<br>
&gt; Where enabled = true by default and types = ALL by default. types would<br>
&gt; only be considered if enabled = true.<br>
&gt;<br>
&gt; //enable validation for type<br>
&gt; @ValidateExecutables<br>
&gt; public class Foo {<br>
&gt;<br>
&gt; }<br>
&gt;<br>
&gt; //exclude getters<br>
&gt; @ValidateExecutables(types={CONSTRUCTORS, NON_GETTERS})<br>
&gt; public class Foo {<br>
&gt;<br>
&gt; }<br>
&gt;<br>
&gt; @ValidateExecutables<br>
&gt; public class Foo {<br>
&gt;<br>
&gt;     @ValidateExecutables(enabled=false)<br>
&gt;     public getFoo() { ... }<br>
&gt; }<br>
&gt;<br>
&gt; This would avoid the mixing of two things in one enum as mentioned by Hardy<br>
&gt; and also circumvent the naming issue. On a single method,<br>
&gt; @ValidateExecutables(enabled=false) is still a bit lengthy, but I think<br>
&gt; it&#39;s better than @ValidateExecutables(types = NONE).<br>
&gt;<br>
&gt; --Gunnar<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; 2013/2/15 Hardy Ferentschik &lt;<a href="mailto:hardy@hibernate.org" target="_blank">hardy@hibernate.org</a>&gt;<br>
&gt;<br>
&gt; &gt; Hi,<br>
&gt; &gt;<br>
&gt; &gt; To have a enum which truly makes sense we would have to go for two<br>
&gt; &gt; annotations.<br>
&gt; &gt;<br>
&gt; &gt; We try to mix two semantics into a single emum. One is the on/off switch<br>
&gt; &gt; and one<br>
&gt; &gt; is the types of executables to validate. No matter how you rename the enum<br>
&gt; &gt; will always<br>
&gt; &gt; read awkward unless we separate these two things.<br>
&gt; &gt;<br>
&gt; &gt; I could live with @ValidateExecutables and @ValidateExecutable. I don&#39;t<br>
&gt; &gt; think that it<br>
&gt; &gt; is a problem that in other contexts the @Xs is a list of @X annotations.<br>
&gt; &gt;<br>
&gt; &gt; --Hardy<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; On 14 Jan 2013, at 5:55 PM, Emmanuel Bernard &lt;<a href="mailto:emmanuel@hibernate.org" target="_blank">emmanuel@hibernate.org</a>&gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt; &gt; Pete from CDI gave me the same feedback.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; There are a few competing alternatives<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; ## enum adjustments<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; @ValidateExecutable.type defaults to ALL<br>
&gt; &gt; &gt; and rename ElementType.NONE to ElementType.OFF or NO<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; We can even rename type to value to make the user even easier at the<br>
&gt; &gt; &gt; risk of harder evolutions if we need to add more parameters down the<br>
&gt; &gt; &gt; road.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; ## two annotations<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; @ValidateExecutable(ON|OFF) targeting methods and constructors<br>
&gt; &gt; &gt; @ValidateExecutables(ALL|NON_GETTER_METHODS|...)<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; The downside is that the @Xxxs convention is used to add several times<br>
&gt; &gt; &gt; the same annotation. This is widely used in EE for example.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; We could try and find better (different) names for these annotations but<br>
&gt; &gt; &gt; I could not find a good set.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; What are your preferences?<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On Mon 2013-02-11 11:04, Emmanuel Bernard wrote:<br>
&gt; &gt; &gt;&gt; Santiago from the JAX-RS EG is concerned that we have created an<br>
&gt; &gt; &gt;&gt; over-engineered solution to enable / disable method validation on a per<br>
&gt; &gt; &gt;&gt; method basis.<br>
&gt; &gt; &gt;&gt; We have good reasons for it but I am wondering if we can make it a bit<br>
&gt; &gt; &gt;&gt; easier to enable or disable methods out of the box.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Remember, the default is to ignore getters. If we make<br>
&gt; &gt; &gt;&gt; @ValidateExecutable.type default to ALL, enabling it on a getter would<br>
&gt; &gt; &gt;&gt; be<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;    @NotEmpty @ValidateExecutable<br>
&gt; &gt; &gt;&gt;    public String getAction() {...}<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; instead of<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;    @NotEmpty @ValidateExecutable(type=ExecutableType.ALL)<br>
&gt; &gt; &gt;&gt;    public String getAction() {...}<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; We would still need the verbose approach to disable validation<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt;    @NotEmpty @ValidateExecutable(type=ExecutableType.NONE)<br>
&gt; &gt; &gt;&gt;    public String getAction() {...}<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; I am open to suggestions to make that easier on methods. I don&#39;t think<br>
&gt; &gt; &gt;&gt; an additional annotation will make anything easier<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Maybe renaming NONE with OFF might help? It&#39;s a bit weirder on a<br>
&gt; &gt; &gt;&gt; class-level but that might work.<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Thoughts?<br>
&gt; &gt; &gt;&gt;<br>
&gt; &gt; &gt;&gt; Emmanuel<br>
&gt; &gt; &gt;&gt; _______________________________________________<br>
&gt; &gt; &gt;&gt; beanvalidation-dev mailing list<br>
&gt; &gt; &gt;&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
&gt; &gt; &gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; beanvalidation-dev mailing list<br>
&gt; &gt; &gt; <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
&gt; &gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; beanvalidation-dev mailing list<br>
&gt; &gt; <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
&gt; &gt;<br>
<br>
&gt; _______________________________________________<br>
&gt; beanvalidation-dev mailing list<br>
&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
<br>
_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
</div></div></blockquote></div><br></div></div>