[bv-dev] Proposal for supporting new Java 8 date/time types

Guillaume Smet guillaume.smet at gmail.com
Wed Nov 9 18:29:59 EST 2016


Hi,

So I started to work on a first implementation in the API, the TCK and in
HV.

It's a bit different from the latest draft of Michael but I think it should
be a good base for our discussions.

* Bean Validation API:
https://github.com/beanvalidation/beanvalidation-api/pull/70
* Bean Validation TCK:
https://github.com/beanvalidation/beanvalidation-tck/pull/77
* HV: https://github.com/hibernate/hibernate-validator/pull/576

Main differences are:
* I didn't use introspection to build the now object from the Clock and get
the compareTo method. It would save some code but I don't think it's a good
idea. I agree that it limits the support to officially supported types but
I like it better this way. AbstractJavaTimeValidator makes it easy to add
support for other types if required;
* I implemented all the default java.time types in this first round but
I'll add optional support for threeten-extras as a proprietary extension in
a followup-up patch if we decide to keep this approach;
* I named the nowIsValid option orPresent leading to having something like
@Past(orPresent = true) which does not look too bad.

Comments welcome!

-- 
Guillaume

On Wed, Oct 19, 2016 at 11:24 AM, Gunnar Morling <gunnar at hibernate.org>
wrote:

> Hi Michael,
>
> +1 for splitting it up into two parts and have the discussion around
> Duration et al. separately. Based on that, do you think you could send a PR
> with the first pieces some time soon?
>
> I think it'd be great to put out an Alpha1 of the spec and the RI
> containing this change and the other things we have so far. It's just the
> first steps, but pushing it out demonstrates progress and allows to get
> feedback early on.
>
> My idea would be to do an Alpha1 with these changes around the end of this
> month. WDYT?
>
> Thanks,
>
> --Gunnar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20161110/b5217226/attachment.html 


More information about the beanvalidation-dev mailing list