You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2009/11/17 17:32:19 UTC
svn commit: r881361 - in /commons/proper/jexl/trunk: pom.xml
src/main/java/org/apache/commons/jexl/package.html xdocs/index.xml
xdocs/reference/examples.xml xdocs/releases.xml xdocs/style/ xdocs/xdoc.xsl
Author: henrib
Date: Tue Nov 17 16:32:19 2009
New Revision: 881361
URL: http://svn.apache.org/viewvc?rev=881361&view=rev
Log:
Updated documentation; removed some xdoc related elements, revamped content.
Get ready for RC3.
Removed:
commons/proper/jexl/trunk/xdocs/style/
commons/proper/jexl/trunk/xdocs/xdoc.xsl
Modified:
commons/proper/jexl/trunk/pom.xml
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/package.html
commons/proper/jexl/trunk/xdocs/index.xml
commons/proper/jexl/trunk/xdocs/reference/examples.xml
commons/proper/jexl/trunk/xdocs/releases.xml
Modified: commons/proper/jexl/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/pom.xml?rev=881361&r1=881360&r2=881361&view=diff
==============================================================================
--- commons/proper/jexl/trunk/pom.xml (original)
+++ commons/proper/jexl/trunk/pom.xml Tue Nov 17 16:32:19 2009
@@ -117,7 +117,7 @@
<commons.componentid>jexl</commons.componentid>
<commons.release.version>2.0</commons.release.version>
<!-- The RC version used in the staging repository URL. -->
- <commons.rc.version>RC2</commons.rc.version>
+ <commons.rc.version>RC3</commons.rc.version>
<commons.binary.suffix />
<commons.jira.id>JEXL</commons.jira.id>
<commons.jira.pid>12310479</commons.jira.pid>
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/package.html
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/package.html?rev=881361&r1=881360&r2=881361&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/package.html (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl/package.html Tue Nov 17 16:32:19 2009
@@ -34,30 +34,7 @@
JEXL is a library intended to facilitate the implementation of dynamic and scripting features in applications
and frameworks.
</p>
- <p>
- It enables coding configuration, module/component loose-coupling dependencies or simple template capabilities using a
- small footprint API.
- Its name itself stands for Java EXpression Language, a simple expression language inspired by Jakarta Velocity
- and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL) and
- JavaServer Pages version 2.0 (JSP).
- </p>
- <p>
- The API and the expression language exploit Java-beans naming patterns through
- introspection to expose property getters and setters.
- </p>
- <p>
- JEXL attempts to bring some of the lessons learned by the Velocity
- community about expression languages in templating to a wider audience.
- <a href="http://commons.apache.org/jelly">Commons Jelly needed</a>
- Velocity-ish method access, it just had to have it.
- </p>
- <p>
- It must be noted that JEXL is not a compatibile implementation of EL as defined
- in JSTL 1.1 (JSR-052) or JSP 2.0 (JSR-152). For a compatible implementation of
- these specifications, see the <a href="http://commons.apache.org/el">
- Commons EL</a> project.
- </p>
-
+
<h2><a name="example">A Brief Example</a></h2>
<p>
When evaluating expressions, JEXL merges an
@@ -93,7 +70,7 @@
<ul>
<li>Dynamic invocation of setters, getters, methods and constructors</li>
<li>Script expressions known as JEXL expressions</li>
- <li>JSP/JSF like expression known as UnifiedJEXL expresions</li>
+ <li>JSP/JSF like expression known as UnifiedJEXL expressions</li>
</ul>
<h3><a name="usage_api">Dynamic invocation</a></h3>
@@ -104,10 +81,10 @@
set of methods:
</p>
<ul>
+ <li>{@link org.apache.commons.jexl.JexlEngine#newInstance}</li>
<li>{@link org.apache.commons.jexl.JexlEngine#setProperty}</li>
<li>{@link org.apache.commons.jexl.JexlEngine#getProperty}</li>
<li>{@link org.apache.commons.jexl.JexlEngine#invokeMethod}</li>
- <li>{@link org.apache.commons.jexl.JexlEngine#newInstance}</li>
</ul>
The following example illustrate their usage:
<pre>
@@ -186,7 +163,7 @@
JexlEngine jexl = new JexlEngine();
UnifiedJEXL ujexl = new UnifiedJEXL(jexl);
UnifiedJEXL.Expression expr = ujexl.parse("Hello ${user}");
- String hello = expr.evaluate(context, expr);
+ String hello = expr.evaluate(context, expr).toString();
</pre>
<h2><a name="configuration">JEXL Configuration</a></h2>
Modified: commons/proper/jexl/trunk/xdocs/index.xml
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/xdocs/index.xml?rev=881361&r1=881360&r2=881361&view=diff
==============================================================================
--- commons/proper/jexl/trunk/xdocs/index.xml (original)
+++ commons/proper/jexl/trunk/xdocs/index.xml Tue Nov 17 16:32:19 2009
@@ -22,53 +22,83 @@
</properties>
<body>
- <section name="Java Expression Language (JEXL)">
- <p>
- JEXL is a library intended to facilitate the implementation of dynamic and scripting features in applications
- and frameworks.
- It enables coding configuration, module/component loose-coupling dependencies or simple template capabilities using a
- small footprint API.
- </p>
- <p>
- Its name stands for Java EXpression Language, a simple expression language inspired by Jakarta Velocity
- and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL) and
- JavaServer Pages version 2.0 (JSP).
- </p>
- <p>
+ <section name="Java Expression Language (JEXL)">
+ <p>
+ JEXL is a library intended to facilitate the implementation of dynamic and scripting features in
+ applications and frameworks.
+ </p>
+ <p>
+ It is a small footprint "glueing" API
+ - the <a href="apidocs/org/apache/commons/jexl/package-summary.html#usage">core features</a> fit in
+ 3 classes and 10 methods - that can be used in various conditions:
+ <ul>
+ <li>Module or component configuration:
+ <ul>
+ <li>Your application has configuration files (eventually generated by a design module)
+ consumed by the end-user module that would benefit from variables and expressions.
+ </li>
+ <li>When it would be convenient to use IOC but overall complexity doesn't require
+ (or can't depend upon) a full-blown library (Spring, Guice...).
+ </li>
+ </ul>
+ </li>
+ <li>Loose-coupling of interfaces and implementations or duck-typing:
+ <ul>
+ <li>You have optional classes that your code cant consider as compilation dependencies.</li>
+ <li>You have to integrate and call "legacy" code or use components that you dont want to
+ strongly depend upon.</li>
+ </ul>
+ </li>
+ <li>Basic scripting features:
+ <ul><li>Your application lets (advanced) users evaluate or define some simple expressions
+ like computation formulas.</li></ul>
+ </li>
+ <li>Simple template capabilities:
+ <ul><li>Your application has basic template requirements and JSPs or
+ Velocity would be overkill or too inconvenient to deploy.</li></ul>
+ </li>
+ </ul>
+ </p>
+ <p>
+ Its name stands for Java EXpression Language, a simple expression language inspired by Jakarta
+ Velocity and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL)
+ and JavaServer Pages version 2.0 (JSP). JEXL 2.0 adds features inspired by
+ <a href="http://java.sun.com/products/jsp/reference/techart/unifiedEL.html">Unified EL</a>.
+ </p>
+ <p>
The API and the expression language exploit Java-beans naming patterns through
introspection to expose property getters and setters.
- </p>
- <p>
+ </p>
+ <p>
JEXL attempts to bring some of the lessons learned by the Velocity
community about expression languages in templating to a wider audience.
- <a href="http://commons.apache.org/jelly">Commons Jelly needed</a>
+ <a href="http://commons.apache.org/jelly">Commons Jelly</a> needed
Velocity-ish method access, it just had to have it.
- </p>
- <p>
- It must be noted that JEXL is not a compatibile implementation of EL as defined
+ </p>
+ <p>
+ It must be noted that JEXL is <strong>not</strong> a compatible implementation of EL as defined
in JSTL 1.1 (JSR-052) or JSP 2.0 (JSR-152). For a compatible implementation of
- these specifications, see the <a href="http://commons.apache.org/el">
- Commons EL</a> project.
- </p>
- </section>
+ these specifications, see the <a href="http://commons.apache.org/el">Commons EL</a> project.
+ </p>
+ </section>
- <section name="A Brief Example">
- <p>
+ <section name="A Brief Example">
+ <p>
When evaluating expressions, JEXL merges an
- <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/Expression.html">Expression</a>
+ <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/Expression.html">Expression</a>
with a
- <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlContext.html">JexlContext</a>.
+ <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlContext.html">JexlContext</a>.
An Expression is created using
- <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/ExpressionFactory.html#createExpression(java.lang.String)">ExpressionFactory.createExpression()</a>,
+ <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlEngine.html#createExpression(java.lang.String)">ExpressionFactory.createExpression()</a>,
passing a String containing valid JEXL syntax. A JexlContext is created using
- <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlHelper.html#createContext()">JexlHelper.createContext()</a>,
+ <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlHelper.html#createContext()">JexlHelper.createContext()</a>,
and variables are put into a map exposed through the
- <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlContext.html#getVars()">getVars()</a>
+ <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlContext.html#getVars()">getVars()</a>
method on JexlContext. The following example, takes a variable named foo, and
invokes the bar() method on the property innerFoo:
- </p>
+ </p>
- <source><![CDATA[
+ <source><![CDATA[
// Create or retrieve a JexlEngine
JexlEngine jexl = new JexlEngine();
// Create an expression object
@@ -81,100 +111,91 @@
// Now evaluate the expression, getting the result
Object o = e.evaluate(jc);
- ]]></source>
- </section>
+ ]]>
+ </source>
+ </section>
- <section name="Extensions to JSTL Expression Language">
- <p>
+ <section name="Extensions to JSTL Expression Language">
+ <p>
While JEXL is similar to the expression language defined in JSTL, it has improved
upon the syntax in a few areas:
- </p>
+ </p>
+ <ul>
+ <li>Support for invocation of any accessible method (see example above).</li>
+ <li>A general <span class="literal">size()</span> method, which works on:
+ <ul>
+ <li><span class="literal">String</span> - returns length</li>
+ <li><span class="literal">Map</span> - returns number of keys</li>
+ <li><span class="literal">List</span> - returns number of elements.</li>
+ </ul>
+ </li>
+ <li>A general <span class="literal">empty()</span> method, which works on Collections and Strings.</li>
+ <li>A general <span class="literal">new()</span> method allowing to instantiate objects.</li>
+ <li>Support for the ternary operator 'a ? b : c' - and its GNU-C / "Elvis" variant 'a ?: c'.</li>
+ <li>Misc : '+' has been overloaded to be use as a String concatenation operator</li>
+ </ul>
- <ul>
- <li>
- Support for invocation of any accessible method (see example above).
- </li>
- <li>
- A general <span class="literal">size()</span> method, which works on:
- <ul>
- <li><span class="literal">String</span> - returns length</li>
- <li><span class="literal">Map</span> - returns number of keys</li>
- <li><span class="literal">List</span> - returns number of elements.</li>
- </ul>
- </li>
- <li>
- A general <span class="literal">empty()</span> method, which works on Collections and Strings.
- </li>
- <li>
- A general <span class="literal">new()</span> method allowing to instantiate objects.
- </li>
- <li>
- Support for the ternary operator 'a ? b : c' - and its GNU-C / "Elvis" variant 'a ?: c'.
- </li>
- <li>
- Misc : '+' has been overloaded to be use as a String concatenation operator
- </li>
+ </section>
- </ul>
-
- </section>
-
- <section name="Releases">
- <p>
+ <section name="Releases">
+ <p>
The current released version is 2.0.
See the <a href="releases.html">releases</a> page for information on obtaining releases.
- </p>
- </section>
+ </p>
+ </section>
- <section name="Related Resources">
- <p>
+ <section name="Related Resources">
+ <p>
JEXL is not a product of the Java Community Process (JCP), but it provides a
similar expression syntax. For more information about JSP 2.0 EL and JSTL 1.1
EL:
- </p>
- <ul>
- <li>
- <a href="http://java.sun.com/products/jsp/index.jsp">JSP 2.0</a> is covered
+ </p>
+ <ul>
+ <li>
+ <a href="http://java.sun.com/products/jsp/index.jsp">JSP 2.0</a> is covered
by Java Specification Requests (JSR)
- <a href="http://www.jcp.org/en/jsr/detail?id=152">JSR-152: JavaServer
+ <a href="http://www.jcp.org/en/jsr/detail?id=152">JSR-152: JavaServer
Pages 2.0 Specification</a>.
- </li>
- <li>
+ </li>
+ <li>
Apache has an implementation of the expression language for JSP 2.0,
called <a href="http://commons.apache.org/el/index.html">EL</a>
- </li>
- <li>
- <a href="http://java.sun.com/products/jsp/jstl/">JSTL 1.1</a> is covered
- by <a href="http://jcp.org/en/jsr/detail?id=52">JSR 52: A Standard
- Tag Library for JavaServer Pages</a>. See the
- <a href="http://java.sun.com/products/jsp/jstl/1.1/docs/api/index.html">JSTL API</a>.
- </li>
+ </li>
+ <li>
+ <a href="http://java.sun.com/products/jsp/jstl/">JSTL 1.1</a> is covered
+ by <a href="http://jcp.org/en/jsr/detail?id=52">JSR 52: A Standard
+ Tag Library for JavaServer Pages</a>. See the
+ <a href="http://java.sun.com/products/jsp/jstl/1.1/docs/api/index.html">JSTL API</a>.
+ </li>
<li>Apache has a <a href="http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html">JSTL Implementation</a>.</li>
- </ul>
- <subsection name="Velocity">
- <p>
- <a href="http://jakarta.apache.org/velocity">Jakarta Velocity</a> implements
+ </ul>
+ <subsection name="Velocity">
+ <p>
+ <a href="http://jakarta.apache.org/velocity">Jakarta Velocity</a> implements
a similar expression language.
- </p>
- <p>
+ </p>
+ <p>
In particular the <a href="http://jakarta.apache.org/velocity/user-guide.html#References">References</a>
section of the User Guide has some good information on properties and method which correlate
directly to JEXL.
- </p>
- </subsection>
- </section>
-
- <section name="Anyone Using It Yet?">
- <ul>
- <li>
- <a href="http://commons.apache.org/jelly">Jelly</a>
- </li>
- <li>
- <a href="http://commons.apache.org/scxml">Commons SCXML</a>
- </li>
- </ul>
- </section>
+ </p>
+ </subsection>
+ </section>
+
+ <section name="Anyone Using It Yet?">
+ <ul>
+ <li>
+ <a href="http://commons.apache.org/configuration">Commons Configuration</a>
+ </li>
+ <li>
+ <a href="http://commons.apache.org/scxml">Commons SCXML</a>
+ </li>
+ <li>
+ <a href="http://commons.apache.org/jelly">Jelly</a>
+ </li>
+ </ul>
+ </section>
- </body>
+ </body>
</document>
Modified: commons/proper/jexl/trunk/xdocs/reference/examples.xml
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/xdocs/reference/examples.xml?rev=881361&r1=881360&r2=881361&view=diff
==============================================================================
--- commons/proper/jexl/trunk/xdocs/reference/examples.xml (original)
+++ commons/proper/jexl/trunk/xdocs/reference/examples.xml Tue Nov 17 16:32:19 2009
@@ -18,7 +18,7 @@
<document>
<properties>
- <title>Commons JEXL 1.0 Examples</title>
+ <title>Commons JEXL Examples</title>
</properties>
<body>
@@ -28,7 +28,6 @@
<ul>
<li><a href="#Evaluating Expressions">Evaluating Expressions</a></li>
<li><a href="#Custom Contexts">Custom Contexts</a></li>
- <li><a href="#Custom Resolvers">Custom Resolvers</a></li>
<li><a href="#Example Expressions">Example Expressions</a></li>
</ul>
</p>
@@ -113,20 +112,6 @@
</source>
</p>
</section>
- <section name="Custom Resolvers">
- <p>
- JEXL allows you to add custom expression resolvers that will get called with before or after expression
- evaluation.
- </p>
- <p>
- If <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlExprResolver.html">pre-resolvers</a>
- is added to an expression, any value it returns will be used instead of that normally provided by JEXL. If JEXL evaluates
- an expression to <code>null</code> post-resolvers of an expression are called in turn in an attempt to get a value.
- </p>
- <p>
- Expression resolvers are called in the order that they are added.
- </p>
- </section>
<section name="Example Expressions">
<!-- invoking methods, property access, array access, empty, size etc... -->
<subsection name="Arithmetic">
@@ -136,11 +121,11 @@
12.0 - 5.2
6 * 12 + 5 / 2.6
12 % 2
-6 div 4
+6 / 4
-12 + 77.2
x * 1.1 + y
</source>
- <p>Arithmetic expressions can use variables. <code>null</code> is treated as a zero for arithmetic.</p>
+ <p>Arithmetic expressions can use variables. <code>null</code> can be treated as a zero for arithmetic.</p>
</subsection>
<subsection name="Calling methods">
<p>
Modified: commons/proper/jexl/trunk/xdocs/releases.xml
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/xdocs/releases.xml?rev=881361&r1=881360&r2=881361&view=diff
==============================================================================
--- commons/proper/jexl/trunk/xdocs/releases.xml (original)
+++ commons/proper/jexl/trunk/xdocs/releases.xml Tue Nov 17 16:32:19 2009
@@ -16,34 +16,33 @@
limitations under the License.
-->
<document>
- <properties>
- <title>Downloads</title>
- </properties>
-
- <body>
- <section name="Releases">
-
- <p><strong>Latest Stable Release</strong></p>
- <ul>
- <li><a href="http://commons.apache.org/downloads/download_jexl.cgi">1.1 Binary/Source</a></li>
- </ul>
-
-
- <p><strong>Nightly Builds</strong></p>
- <ul>
- <li><a href="http://people.apache.org/builds/commons/nightly/commons-jexl/">Binary/Source</a></li>
- </ul>
-
- <p>
- <strong>Archived Releases</strong>
- <br/>
+ <properties>
+ <title>Downloads</title>
+ </properties>
+
+ <body>
+ <section name="Releases">
+ <p><strong>Latest Stable Release</strong></p>
+ <ul>
+ <li>
+ <a href="http://commons.apache.org/downloads/download_jexl.cgi">2.0 Binary/Source</a>
+ </li>
+ </ul>
+ <p><strong>Nightly Builds</strong></p>
+ <ul>
+ <li>
+ <a href="http://people.apache.org/builds/commons/nightly/commons-jexl/">Binary/Source</a>
+ </li>
+ </ul>
+ <p>
+ <strong>Archived Releases</strong>
+ <br/>
Older releases are retained by the Apache Software Foundation but are
moved into a
- <a href="http://archive.apache.org/dist/commons/jexl/">
- special archive area</a>.
- </p>
-
- </section>
-
- </body>
+ <a href="http://archive.apache.org/dist/commons/jexl/">
+ special archive area
+ </a>.
+ </p>
+ </section>
+ </body>
</document>