ExpressionEvaluator abstracts OGNL by providing an OGNL independent interface for evaluating expressions. It is very useful not only for bindings but for custom usage as well. I'd like to propose some enhancements to make it more useable:
- add more configuration options, for example allow specifying a custom OGNL class resolver
- allow custom context variables like
public Object read(Object target, String expression, Map<String, ?> variables);
The values in "variables" would be accessible as OGNL global variables, eg. #mycustomvariable
For more information see http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/varref.html
(- maybe the interface should be renamed to OgnlExpressionEvaluator)
(- maybe there could be configurable default variables when evaluating bindings, like #locale -> requestCycle.engine.locale. These would help for application developers to simplify the page files. I know that it is another way to implement existing functionality - <inject> - but maybe it would be useful.)
The two latter are only quick ideas but the rest would be very useful!
If you think so then I send my own ExpressionEvaluator implementation (which is compatible with the current one in Tapestry).