<div dir="ltr">Hi all,<div><br></div><div>I've started to work on a new version of the XSD for constraint mapping files in order to allow for the XML-based configuration of method/constructor constraints [1] and group conversions [2]. The latest XSD draft can be found at [3].</div>
<div><br></div><div>The following shows how the configuration of method constraints and group conversions would look like:</div><br>� � <bean class="com.acme.MyBean" ignore-annotations="false"><br>
� � � � <method name="getFirstname" ignore-annotations="true"><br>
� � � � � � <parameter type="java.lang.String"><br>� � � � � � � ��<constraint annotation="javax.validation.constraints.Pattern">�<br>� � � � � ��� ��� � <message>Last name has to start with with a capital letter.</message><div>
� � � � � � � ��� ��<element name="regexp">^[A-Z][a-z]+</element></div><div>� ��� � � � � � </constraint><br>� ��� ��� � </parameter></div><div>� � � ��� ��<parameter type="int"></div>
<div>� � � � � ��� ��<valid/></div><div>� ��� � � � � � <constraint annotation="javax.validation.constraints.Min"><br>� ��� ��� � � � � � <element name="value">1</element></div>
<div>� � � ��� ��� � </constraint></div><div>� ��� � � � � � <convertGroup from="javax.validation.groups.Default" to="com.acme.Basic"/><br>� ��� ��� � </parameter></div><div><span class="">� � � � � � <</span><span class="">parameter</span><span class=""> </span>type<span class="">=</span><span class="">"long"</span><span class=""> </span>ignore-annotations<span class="">=</span><span class="">"false"</span><span class="">/></span></div>
<div>� ��� � � � <returnValue><br>� ��� ��� � � � <valid/></div><div>� � � ��� ��� � <constraint annotation="javax.validation.constraints.Pattern"></div><div>� � � � � ��� ��� � <message>Last name has to start with with a capital letter.</message></div>
<div>� � � � � � � ��� ��<element name="regexp">^[A-Z][a-z]+</element></div><div>� ��� � � � � � </constraint><br>� ��� ��� � </returnValue></div><div>� � � ��� ��<crossParameterConstraint annotation="com.acme.MyCrossParameterConstraint"/></div>
<div>� ��� � </method></div><div>� � </bean></div><div><br></div><div>I tried to follow the existing style and patterns. Some notes:</div><div><br></div><div>* Always all the parameters of an executable must be specified in order to identify overloaded executables, also if the configuration of a particular parameter shall remain unchanged (ignore-annotations<span class="">=</span><span class="">"false" is to be used in this case).</span></div>
<div style><span class="">* ignore-annotations on methods/constructors overrides ignore-annotations on the bean level;�</span>ignore-annotations on parameters/return values overrides ignore-annotations on the method/constructor and bean levels</div>
<div style><span class="">* parameters are identified by their type. The FQN of the type is to be used (taking "default-package" into account), or "int", "long" etc. for primitive types.</span></div>
<div style><span class="">* A getter method must either be configured using the "getter" or the "method" element. If both are given for one and the same getter, a ValidationException will be thrown.</span></div>
<div style><span class=""><br></span></div><div style><span class="">Is there anything else we should add or consider? If there are no objections, I'll move forward with adapting the spec next week.</span></div><div style>
<span class=""><br></span></div><div style>Thanks,</div><div style><br></div><div style>--Gunnar</div>
<div><br><div>[1]�<a href="https://hibernate.onjira.com/browse/BVAL-273" target="_blank">https://hibernate.onjira.com/browse/BVAL-273</a></div><div>[2]�<a href="https://hibernate.onjira.com/browse/BVAL-333" target="_blank">https://hibernate.onjira.com/browse/BVAL-333</a></div>
<div>[3]�<a href="https://github.com/gunnarmorling/hibernate-validator/compare/HV-373">https://github.com/gunnarmorling/hibernate-validator/compare/HV-373</a></div><div><br></div>
</div></div>