Support new date/time datatypes (JSR 310)

Description

The @Past and @Future constraints should be supported for the new JSR 310 date/time types such as LocalDate.

Environment

None

Activity

Show:
Khalid Alqinyah
May 22, 2014, 9:07 AM

I don't think the number of validator instances matters. Maintenance of constraint validator instances is quite easy (leaving the more controversial constraints like Email, URL and SafeHtml out of the picture). Most of them we wrote once and never had to update. Is there no common base class to unify things? With JodaTime this was for example the case. Not sure what the new Java 8 classes look like though.

Just counted again, there are 14 types, 5 of them have a common base class.

We can also use Temporal which is the base class for all date/time types, and have only one validator with casting, but I'm not sure how clean this will be.

Gunnar Morling
May 22, 2014, 9:13 AM

Temporal might indeed be too unspecific. ChronoLocalDate and ChronoLocalDateTime might be good starting points, they provide isBefore()/isAfter() semantics.

Khalid Alqinyah
May 22, 2014, 9:16 AM

Temporal might indeed be too unspecific. ChronoLocalDate and ChronoLocalDateTime might be good starting points, they provide isBefore()/isAfter() semantics.

Yes, ChronoLocalDate is the base class for the five types I mentioned earlier. But ChronoLocalDateTime is only a base class for LocalDateTime.

Khalid Alqinyah
May 23, 2014, 12:28 PM

So, all types will be supported using base classes when possible. This will leave us with 10 future and 10 past validators.

Hardy Ferentschik
May 23, 2014, 2:12 PM

Sounds good.

Assignee

Khalid Alqinyah

Reporter

Gunnar Morling

Labels

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Fix versions

Priority

Major
Configure