[bv-dev] First Alpha release of Bean Validation 2.0 RI

Marco Molteni moltenma at gmail.com
Wed Feb 22 17:34:24 EST 2017


Michael I see the business case for the Period validation, but the
complexity (impossibility) of a reliable comparison between Periods it
seems widespread and accepted between the developers. Personally I don't
see the benefits to have it in the spec if it risks to generate confusion
or errors.

If you have some inputs, these are welcome. Could you enrich your previous
example (years, month, days)?

Thanks

On Tue, Feb 21, 2017 at 8:51 AM, Gunnar Morling <gunnar at hibernate.org>
wrote:

> 2017-02-20 20:13 GMT+01:00 Michael Nascimento <misterm at gmail.com>:
> > On Fri, Feb 17, 2017 at 5:11 AM, Gunnar Morling <gunnar at hibernate.org>
> > wrote:
> >>
> >> > You don't compare, because they are not the same. The idea is that the
> >> > Period must be defined in terms of the units for which you defined its
> >> > boundaries.
> >>
> >> I see. I'm wondering though how practical that will be. Will the
> >> developer who puts the constraint always know the structure of the
> >> Period set to the field (data set by the application user)?
> >
> >
> > In the case you want it to be validated, you ought to :-)
>
> But that's the problem, can you really?
>
> The actual field values are set at application runtime, e.g. entered
> by a user sitting in front of the application. So the application
> developer would have to "lock down" whatever can be put in to match
> the unit set in the constraint. It's doable but I'm having doubts that
> this constraint pulls its eight eventually.
>
> >
> >>
> >>
> >> > You shouldn't support threeten-extra, but rather arbitrary
> >> > TemporalAmounts.
> >> > Then threeten-extra just happen to be one of those. There must be
> >> > something
> >> > like @ChronoUnitMax/@ChronoUnitMin such as:
> >> >
> >> > @ChronoUnitMax(unit=DAYS, value=1)
> >>
> >> How would that look like for a Period with several elements set, e.g.
> >> "3 months, 2 days"? Would we need a dedicated member in @ChronoUnitMax
> >> for each value of ChronoUnit (which are a lot)?
> >
> >
> > What do you mean by a member in @ChronoUnitMax? In my example, I suggest
> > using unit as a member, leading to unit and value being the only members.
>
> By member I meant months(), days(), hours() etc. In the "one unit, one
> value" model, how would you express "max 3 month and two weeks"? We
> could exclude such case of course, it may sufficiently well be
> expressed as "max 10 weeks".
>
> >
> >>
> >> We had a discussion of Duration et al. a while ago, but it petered
> >> out. So we thought we'd add something to the RI to spark a new
> >> discussion. Seems it worked :)
> >
> >
> > Can´t disagree :-)
> >
> > Regards,
> > Michael
> >
> > _______________________________________________
> > 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/20170222/8b93765d/attachment.html 


More information about the beanvalidation-dev mailing list