<div dir="ltr">I think the algorithm should cover for that case, even if we didn't plan for it.<div><br></div><div>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.<div>
<br></div><div>So considering the following example:</div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px"> @ThresholdMax(value=10, messageThreshold=50, message="${validatedValue > {messageThreshold} ? '{muchTooLarge.message}' : '{aBitTooLarge.message}'}")</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px"> int myInt = ...;</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Then I'd say algorithm should transform the message like this:</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">After step 3 (resource bundle replacements): "</span><span style="font-family:arial,sans-serif;font-size:13px">${validatedValue > {messageThreshold} ? 'Viel zu groß' : 'Zu groß'}"</span><br>
</div><div><span style="font-family:arial,sans-serif;font-size:13px">After step 4 (resolution of constraint attributes): "</span><span style="font-family:arial,sans-serif;font-size:13px">${validatedValue > 50 ? 'Viel zu groß' : 'Zu groß'}"</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">After step 5 (EL evaluation): "Viel zu groß" or "Zu groß", depending on the threshold value</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">--Gunnar</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/18 Emmanuel Bernard <span dir="ltr"><<a href="mailto:emmanuel@hibernate.org" target="_blank">emmanuel@hibernate.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Depending how the spec is written it might already be too late but I<br>
would definitely like something like that to happen.<br>
<br>
We just need to be careful, which interpolation should happen first or<br>
if we want to do them in a loop until the system rests.<br>
<div><div class="h5"><br>
On Mon 2013-11-18 9:32, Gunnar Morling wrote:<br>
> Hi,<br>
><br>
> I came across an interesting case in the HV user forum [1], where a user is<br>
> essentially nesting messages parameters within an EL expression:<br>
><br>
> ${validatedValue > someValue ? '{x.y.z.message}' : '{x.y.w.message}'}<br>
><br>
> The expectation is that at first the two message parameters are resolved<br>
> and then based on the conditional expression the outer EL expression either<br>
> resolves to one message or the other.<br>
><br>
> This is currently not supported in HV, but reading the interpolation<br>
> algorithm in the spec [2] I can't find anything indicating that this case<br>
> would prohibited. On the other hand I'm not sure whether we intentionally<br>
> meant to support it (at least it never occurred to me); if so, I think we<br>
> should provide an example for this in the spec.<br>
><br>
> The use case seems valid to me, also for cases where one wants to refer to<br>
> constraint attributes in conditional logic. Any thoughts?<br>
><br>
> --Gunnar<br>
><br>
> [1] <a href="https://forum.hibernate.org/viewtopic.php?f=9&t=1029782" target="_blank">https://forum.hibernate.org/viewtopic.php?f=9&t=1029782</a><br>
> [2] <a href="http://beanvalidation.org/1.1/spec/#default-resolution-algorithm" target="_blank">http://beanvalidation.org/1.1/spec/#default-resolution-algorithm</a><br>
<br>
</div></div>> _______________________________________________<br>
> beanvalidation-dev mailing list<br>
> <a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
<br>
_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
</blockquote></div><br></div>