On Fri, Feb 17, 2017 at 5:11 AM, Gunnar Morling <gunnar(a)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 :-)
> 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.
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