[bv-dev] BVAL-192 'exclusive' flag for @DecimalMin/@DecimalMax
Emmanuel Bernard
emmanuel at hibernate.org
Tue Dec 11 08:52:35 EST 2012
I did a quick look at the Expression Language JSR and that might be enough for what we want to do. We could simply delegate message interpolation to the EL engine. It has the ternary operator which would offer what we need for DecimalMin / Max messages.
Can someone dive into this approach to see of that is indeed doable and how much work we need to do in the specification?
On 10 déc. 2012, at 23:53, Hardy Ferentschik <hardy at hibernate.org> wrote:
> Hi,
>
> Seem Michael's and Emmanuel's suggestions are related to BVAL-223 [1].
>
> Regarding this issue I had so far a much simpler improvement of the message interpolation in mind. Something along the lines of Hibernate Validator's
> ValueFormatterMessageInterpolator [2]. There the idea is that parameters can be formatted with the syntax supported by String#format and
> the validated value itself becomes interpolatable as well. Something like '${validatedValue: '%1$5f' }'.
>
> I also like the approach taken in OVal. There you can create/change message variables by overriding 'Map<String, String> createMessageVariables()'.
> Something like this could for example be added to ConstraintValidatorContext.
>
> Obviously this does not solve yet the conditional logic required for the @DecimalMin/Max. Is it realistic that we agree on a syntax for inclusion into
> BV 1.1 given the current time frame? Is there a syntax out there we could base it on.
>
>
> --Hardy
>
>
> [1] https://hibernate.onjira.com/browse/BVAL-223
> [2] https://github.com/hibernate/hibernate-validator/blob/master/engine/src/main/java/org/hibernate/validator/messageinterpolation/ValueFormatterMessageInterpolator.java
>
>
>
> On 10 Jan 2012, at 4:17 PM, Michael Nascimento <misterm at gmail.com> wrote:
>
>> Yes, I think we need to improve on the message format as you suggested
>> to include conditional formatting statements (maybe a ternary?).
>>
>> 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
More information about the beanvalidation-dev
mailing list