You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Thomas Timbul (JIRA)" <de...@myfaces.apache.org> on 2006/01/17 11:35:42 UTC
[jira] Created: (MYFACES-1033) 'empty' EL keyword
'empty' EL keyword
------------------
Key: MYFACES-1033
URL: http://issues.apache.org/jira/browse/MYFACES-1033
Project: MyFaces
Type: Improvement
Versions: 1.1.1
Reporter: Thomas Timbul
Priority: Minor
This probably violates the spec and may not even be in MyFaces scope. (hence 'minor')
I have an implementation where it is (performance-wise) better to call something like 'bean.isEmpty()' than 'bean.getContents().isEmpty()', so in EL that would translate to #{bean.empty} rather than #{empty bean.contents}.
The problem here of course is that empty is a keyword and #{bean.empty} will not parse.
The obvious solution is for me to change the method name from 'isEmpty' to 'isNonEmpty' and negate all calls. However, the name 'isEmpty' is the most natural and 'normal' way to go about it.
Maybe it is possible for the EL parser to check whether a property 'empty' exists before jumping to conclusions. Nobody would use the empty keyword immediately after a dot operator.
Alternatively, allow the use of #{empty bean} which would have the effect of determining whether there is a property 'empty' or a method 'isEmpty' in the bean, like it is done with Collections. Of course I could make my bean a Collection, but that would just be a hack. But so is renaming the method IMHO...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira