[bv-dev] [Java 8] How about support java.time in @Future and @Past?

Gunnar Morling gunnar at hibernate.org
Mon Mar 31 04:07:08 EDT 2014


As Hardy said, these new data types should be supported in the next BV
revision. HV-825 is our testing bed for bringing the new functionalities
from Java 8 to the world of Bean Validation; If you have any ideas around
this make sure to let us know.

Related to that, I think it should be simpler to add additional constraints
in a "global" manner than it is today. One possible way would be to support
registering validator implementations using the service loader SPI, by
providing a file META-INF/services/javax.validation.ConstraintValidator
which lists additional implementations. This avoids the XML and allows to
add a JAR with validators to an application without further need for
registration.

--Gunnar



2014-03-27 12:12 GMT+01:00 Hardy Ferentschik <hardy at hibernate.org>:

> Hi Markus,
>
> thanks for your feedback. Supporting new Java 8 data types seems to be a
> good candidate for
> the next iteration of the Bean Validation spec. If this version will align
> with Java 8, there are other
> candidates as well. For example the ability to annotate collection
> elements (List<@Min(4) String> foo)
> or handling the validation of @Optional values.
>
> At the moment the plan for an new spec release are still in the making.
> However, in Hibenrate Validator
> we already started the work on supporting Java 8 [1], including the new
> date and time types [2].
> Hibernate Validator 5.2 should make this functionality available, probably
> well before there will be a new spec version.
> Once HV 5.2 is available you should be able to upgrade even without a new
> version of the Bean Validation spec.
>
> --Hardy
>
> [1] https://hibernate.atlassian.net/browse/HV-825
> [2] https://hibernate.atlassian.net/browse/HV-874
>
>
>
>
> On 27 Jan 2014, at 06:27, Markus Malkusch <markus at malkusch.de> wrote:
>
> > Dear bean validation
> >
> > Java bean validation 1.1 @Future and @Past constraints are restricted to
> > Calendar and Date only. Adding custom validators for Java 8's java.time
> types
> > is possible as described in 8.1.2. Overriding constraint definitions in
> XML.
> > But I'm just too lazy to do this for my own. I would love to see a new
> spec
> > which includes the Java 8's java.time classes.
> >
> > Sincerly Markus Malkusch_______________________________________________
> > beanvalidation-dev mailing list
> > beanvalidation-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>
>
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20140331/932f61cc/attachment.html 


More information about the beanvalidation-dev mailing list