Java Unified Expression Language 2.1.0 RC3 review

Download
by rbytes.net on

License: The Apache License 2.0
File size: 0K
Developer: Christoph Beck
0 stars award from rbytes.net

Java Unified Expression Language is an implementation of the unified expression language (EL) as specified by the JSP 2.1 standard (JSR-245).

The javax.el.ExpressionFactory implementation is de.odysseus.el.ExpressionFactoryImpl:

// create an expression factory
javax.el.ExpressionFactory factory = new de.odysseus.el.ExpressionFactoryImpl();
Package de.odysseus.el.util provides ready-to-use subclasses of javax.el.ELContext and javax.el.ELResolver:

// create a simple EL context
de.odysseus.el.util.SimpleContext context =
new de.odysseus.el.util.SimpleContext(new de.odysseus.el.util.SimpleResolver());

// define function math:max(int,int)
context.setFunction("math", "max", Math.class.getMethod("max", new Class[]{int.class, int.class}));

// define variable "foo"
context.setVariable("foo", factory.createValueExpression(0, null));

// create expression
javax.el.ValueExpression e = factory.createValueExpression(context, "${math:max(foo,bar)}", null);

// set value for top-level property "bar"
context.setValue(null, "bar", 1);

// evaluate expression...
System.out.println(e.getValue(context)); // --> 1

The JUEL jar may be run from the command line to dump the parse tree of an EL expression:

$ java -jar juel-2.1.x.jar "#{unified(expression[language])}"
+- #{...}
|
+- unified(...)
|
+- [...]
|
+- expression
|
+- language

What's New in This Release:
ListELResolver was missing in SimpleResolver's default chain of resolver delegates.
Minor performance improvements in type conversions and number operations

Java Unified Expression Language 2.1.0 RC3 keywords