<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div><font color="#632423">Hi there,</font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">We are starting to use bean validation in our product and something we would like to do is what I&#8217;ve coined as &#8220;implicit constraints&#8221;. I&#8217;d like to run this by the mailing list and get your thoughts on this as a potential feature in
the spec.</font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">The use case we have is we have a &#8220;DateTime&#8221; object which represents Date &amp; Time. Our DateTime object pre-dates JDK 8 (and JodaTime).&nbsp; A DateTime for us has some constraints</font></div>
<div><font color="#632423">&nbsp;</font></div>
<ol style="margin:0;padding-left:36pt;">
<font color="#632423">
<li>The DateTime cannot me before LOW_DATE <font face="Wingdings">&agrave;</font> 01-01-1970 00:00:00</li><li>The DateTime cannot me after HIGH_DATE <font face="Wingdings">&agrave;</font> 31-12-2150 23:59:59</li></font>
</ol>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">Not sure of the exact history of these constraints but it would seem like we are trying to invent a new y2k <font face="Wingdings">J</font> </font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">These constraints were enforced prior to our usage of Bean Validation as these were burnt into the setter of generated POJO&#8217;s (domain objects) but now that we are moving from generated domain objects to JPA style POJO&#8217;s we&#8217;d like
to use Bean Validation to apply the same constraints. </font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">Assume we have an object which has a DateTime property as shown below</font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font face="Consolas" size="2" color="#7F0055"><span style="font-size:10pt;"><b>public</b><font color="black"> </font><b>class</b><font color="black"> TestObject {</font></span></font></div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Consolas" size="2" color="#7F0055"><span style="font-size:10pt;"><b>private</b></span></font><font face="Consolas" size="2"><span style="font-size:10pt;"> DateTime </span></font><font face="Consolas" size="2" color="#0000C0"><span style="font-size:10pt;">myDateTime</span></font><font face="Consolas" size="2"><span style="font-size:10pt;">;</span></font></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Consolas" size="2" color="#7F0055"><span style="font-size:10pt;"><b>public</b></span></font><font face="Consolas" size="2"><span style="font-size:10pt;"> DateTime getMyDateTime() {</span></font></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Consolas" size="2" color="#7F0055"><span style="font-size:10pt;"><b>return</b></span></font><font face="Consolas" size="2"><span style="font-size:10pt;"> </span></font><font face="Consolas" size="2" color="#0000C0"><span style="font-size:10pt;">myDateTime</span></font><font face="Consolas" size="2"><span style="font-size:10pt;">;</span></font></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Consolas" size="2"><span style="font-size:10pt;">}</span></font></div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Consolas" size="2" color="#7F0055"><span style="font-size:10pt;"><b>public</b></span></font><font face="Consolas" size="2"><span style="font-size:10pt;"> </span></font><font face="Consolas" size="2" color="#7F0055"><span style="font-size:10pt;"><b>void</b></span></font><font face="Consolas" size="2"><span style="font-size:10pt;">
setMyDateTime(DateTime </span></font><font face="Consolas" size="2" color="#6A3E3E"><span style="font-size:10pt;">myDateTime</span></font><font face="Consolas" size="2"><span style="font-size:10pt;">) {</span></font></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Consolas" size="2" color="#7F0055"><span style="font-size:10pt;"><b>this</b></span></font><font face="Consolas" size="2"><span style="font-size:10pt;">.</span></font><font face="Consolas" size="2" color="#0000C0"><span style="font-size:10pt;">myDateTime</span></font><font face="Consolas" size="2"><span style="font-size:10pt;">
= </span></font><font face="Consolas" size="2" color="#6A3E3E"><span style="font-size:10pt;">myDateTime</span></font><font face="Consolas" size="2"><span style="font-size:10pt;">;</span></font></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Consolas" size="2"><span style="font-size:10pt;">}</span></font></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div><font face="Consolas" size="2"><span style="font-size:10pt;">}</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:10pt;">&nbsp;</span></font></div>
<div><font color="#632423">We&#8217;d like if developers did not need to add an annotation all DateTime properties to constrain with the implicit constraints.. i.e.</font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font face="Consolas" size="2"><span style="font-size:10pt;">@Date</span></font></div>
<div><font face="Consolas" size="2" color="#7F0055"><span style="font-size:10pt;"><b>private</b><font color="black"> DateTime </font><font color="#0000C0">myDateTime</font><font color="black">;</font></span></font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">In our opinion this annotation serves no additional purpose and would be an extra onus on the developer to add this so they ensure the value meets internal DateTime criteria. </font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">Looking at the 1.1 spec I cannot see any way of applying constraints without annotating (well you can use HV XML but that would need to be done for all fields).. Is that correct. </font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">I&#8217;ve managed to implement &#8220;implicit constraints&#8221; by using non-standard Hibernate Validator API&#8217;s (i.e. using reflection I added an additional MetaDataProvider which added ConstrainedElements ( to the BeanConfiguration)). I can share
this on GitHub is anyone is interested in taking a look. </font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">Appreciate any feedback you might have.</font></div>
<div><font color="#632423">&nbsp;</font></div>
<div><font color="#632423">Thanks</font></div>
<div><font color="#632423"><br>

Rich</font></div>
<div>&nbsp;</div>
<div>&nbsp;</div>
</span></font>
<p>
<font face="arial,helvetica,sans-serif" size="2">__________________________________________________________<br />FINEOS Corporation is the global brand name of FINEOS Corporation and its affiliated <br />group companies worldwide.<br /><br />The information contained in this e-mail is confidential, may be privileged and is intended <br />only for the use of the recipient named above. If you are not the intended recipient or a <br />representative of the intended recipient, you have received this e-mail in error and must <br />not copy, use or disclose the contents of this e-mail to anybody else.  <br /><br />If you have received this e-mail in error, please notify the sender immediately by return <br />e-mail and permanently delete the copy you received.  This e-mail has been swept for <br />computer viruses. However, you should carry out your own virus checks. <br />Registered in Ireland, No. 205721.  http://www.FINEOS.com<br />__________________________________________________________<br /></font></p>
</body>
</html>