I mean we could but we would need to rely on the string representation
@interface Max {
String value()
}
@Max("12.5")
double someNumber;
On Mar 4, 2009, at 19:17, Emmanuel Bernard wrote:
Unfortunately, you can't support Big* as they are not expressible
in
annotations
@interface Max {
BigDecimal value();
}
does not compile.
On Mar 4, 2009, at 19:14, Elias Ross wrote:
> On Wed, Mar 4, 2009 at 3:49 PM, Emmanuel Bernard <emmanuel(a)hibernate.org
> > wrote:
>> [Follow up with Sebastian]
>>
>> Well good point and frankly I do not know :)
>> 1. do we support float and double for @Min / @Max?
>> 2. if 1 is yes, I'd be inclined to say the value should be double
>> but that's
>> not fully automatic.
>
> How would you go about supporting @Max / @Min for
> java.math.BigDecimal
> ? These would be more useful, since think a lot of this sort of
> validation is intended to fulfill business rules and business math
> requires exact (not floating point) math.
>
> And even in situations you use floating point math, the input and
> state should be probably a BigDecimal value but internally
> calculations could be done (for sake of expedience) using a double
> conversion.
>
> I would probably create a separate @MaxDouble and @MinDouble
> annotation, if at all, but I wouldn't feel easy suggesting users
> build
> constraints using floating point comparisons.