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(a)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/m...
On 10 Jan 2012, at 4:17 PM, Michael Nascimento <misterm(a)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(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
_______________________________________________
beanvalidation-dev mailing list
beanvalidation-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev