hi,
not the sure whether this is so easy. I think the case of nested parameters is not properly covered in the spec atm.
A few comments inline
I think that is basically missing. I am not sure whether it is a good idea to perform message parameter resolution within an EL expression.
On 18 Jan 2013, at 16:31, Gunnar Morling <gunnar@hibernate.org> wrote:
> I think the algorithm should cover for that case, even if we didn't plan for it.
>
> In steps 1 - 4 only message parameters are resolved (against the resource bundles and then in step 4 against constraint attributes). Only in step 5 the EL evaluation is performed. There is no loop back to parameter resolution after EL interpolation.
I’d rather loop back after EL evaluation and perform another message parameter resolution.
> After step 3 (resource bundle replacements): "${validatedValue > {messageThreshold} ? 'Viel zu groß' : 'Zu groß’}"
> So considering the following example:
>
> @ThresholdMax(value=10, messageThreshold=50, message="${validatedValue > {messageThreshold} ? '{muchTooLarge.message}' : '{aBitTooLarge.message}'}")
> int myInt = ...;
>
> Then I'd say algorithm should transform the message like this:
>
there is no need for {messageThreshold} in the comparison. The value for messageTreshold is already bound to the EL context. '${validatedValue > messageThreshold’
is already sufficient.
Also I rather just let the EL return {muchTooLarge.message} resp {aBitTooLarge.message} and then loop back, instead to do replacement with the expression first.
—Hardy
_______________________________________________
beanvalidation-dev mailing list
beanvalidation-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev