<div dir="ltr">Hi all,<div><br></div><div style>As you know we're likely going to exclude getter methods from method validation by default and provide means of configuring the exact behavior (e.g. to have getters validated for individual types).</div>
<div style><br></div><div style>The question is now how this configuration should look like and where it should be described. I think there is two separate components here:</div><div style><br></div><div style>1) BV which provides the logic/engine for performing method validation</div>
<div style>2) Technologies integrating the method validation feature, e.g. CDI, Spring etc. For CDI, the behavior of this integration is described in the BV spec (section 10.2 [1]) as per the Java EE conventions. For e.g. Spring, the behavior would be described in the Spring documentation.</div>
<div style><br></div><div style>Regarding the configuration of including/excluding getters, one option would be to define a BV-specific mechanism for the configuration of (e.g. a global option in validation.xml and/or an annotation like @ValidateOnCall). This mechanism would have to be queried by the technologies integrating with method validation.</div>
<div style><br></div><div style>Alternatively, whether to include/exclude getters could be part of the configuration of 2). For CDI, this might e.g. happen by adding an attribute "validateGetters()" to the interceptor binding annotation triggering method validation, while e.g. Spring users might define an appropriate point cut expression matching all those methods they want to validate. For CDI we would again describe the exact means in section 10.2 of the BV spec.</div>
<div style><br></div><div style>Personally I'd favor the latter approach for the following reasons:</div><div style><br></div><div style>* The configuration of which methods to intercept is IMO a natural responsibility of integrating technologies</div>
<div style>* Integrating technologies already define mechanisms for handling things like inheritance of metadata (e.g. configuration given on super-types), resolving conflicts of global vs. local metadata etc. It makes sense to reuse these mechanisms instead of defining alternative rules in the BV spec.</div>
<div style><br></div><div style>On the downside, one would be limited to the means of configuration provided by a particular integrating technology. E.g. I'm not aware of a way of global configuration options in CDI (we might try to get this changed, though). I still think this should be addressed in the integrating technology instead of BV.</div>
<div style><br></div><div style>Any thoughts?</div><div style><br></div><div style>--Gunnar</div><div style><br></div><div style>[1] <a href="http://beanvalidation.org/latest-draft/spec/#d0e9636">http://beanvalidation.org/latest-draft/spec/#d0e9636</a></div>
<div style><br></div><div style><br></div></div>