-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BVAL-223 #41
BVAL-223 #41
Conversation
following:<itemizedlist> | ||
<listitem> | ||
<para role="tck-testable">if the locale is passed explicitly to | ||
the interpolator method via i<methodname>nterpolate(String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"i" should be part of <methodname
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Note after discussion with @hferentschik and me: str:format or string:format - fairly neutral een though str seems more UI common and emmanuel prefers string a bit more Clarify in the spec that string:format is bound to a Locale sensitive version of String.format (String#format(Locale, String, arg...)) |
In the latest draft there is a syntax for directly referencing static members, but according to this mail this seems to be removed again. This mail speaks about "importing" types, but I can't find in the spec an example how this would be done. |
Would one then always have to specify the local when invoking |
I tried to chase this down as well, but nothing. I think the FunctionMapper is the way to go. I also pinged Pete to get some feedback on the status of JSR 341... |
I thought about two version, but you might be right that in this case we would need to function names. Not sure what's better in this case, two function names 'str:format' and 'str:formatWithLocale' vs a single format where I always have to pass the locale. The latter might not be so bad either. |
On Fri 2013-01-18 10:51, Hardy Ferentschik wrote:
Do you mean that one version would use the MessageInterpolator Locale Do you guys see a use case for the second situation? |
What I mean is that we need a way to pass the Locale requested to the interpolate call to the EL. The only way to do this is to add the requested locale to the EL context as well and use the String#format version which requires an explicit locale, eg ${str:format(locale, "%1$2f", validatedValue} |
Why can we not have the precedence of {} and deprecate it? For me the choices are
|
Can't you bind That would be the best as the user does not have to deal with locales at all. |
On Mon 2013-01-21 4:22, Hardy Ferentschik wrote:
You are correct but what I mean is that if we deprecate it, people So the only way to output paramValue is to use the deprecated solution. The problem does not occur if we have ${} being processed before {}. An alternative solution is to have the existing algorithm handle both {} Makes sense? |
Right, that would be the best, but afaiu that's not possible. See also http://docs.oracle.com/javaee/5/api/javax/el/FunctionMapper.html |
Ok, get you. Maybe the best is to keep both, but I can send an email to the EG |
On Mon 2013-01-21 6:45, Hardy Ferentschik wrote:
Bummer! Can we cheat a bit and have our own Try and propose that to the EG if you think that's a good idea. |
</itemizedlist><phrase role="tck-testable">If the defined expression | ||
is invalid or an unkown property is referenced the message expression | ||
stays unchanged</phrase>.</para> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is happening if an exception occurs during EL evaluation? Is the pattern then returned as is in any case? Or shall e.g. a ValidationException
be thrown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no real distinction between parsing the expression and evaluating it. Generally I suggest to swallow the exception and return the pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, maybe it's worth to rephrase this sentence like this:
If an exception occurs during message interpolation, e.g. due invalid expressions or references to an unknown property, the message expression stays unchanged
?
pushed one more version in this series ;-) Hopefully the last. Now using the Formatter wrapper approach. The spec just specifies that a bean needs to be available exposing format(). |
|
||
<listitem> | ||
<para role="tck-testable">a bean mapped to the name | ||
<constant>formatter</constant> exposing the the vararg method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double "the"
I made some minor spelling/wording remarks, but apart from that, the change looks great IMO now. |
Fixed the typos and removed the requirement for the 'null' literal in case of validatedValue being null. |
Thanks |
Creating pull request to an initial discussion and getting feedback on outstanding questions: