Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 88031 invoked from network); 9 Dec 2009 17:13:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Dec 2009 17:13:39 -0000 Received: (qmail 72597 invoked by uid 500); 9 Dec 2009 17:13:39 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 71940 invoked by uid 500); 9 Dec 2009 17:13:38 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 71749 invoked by uid 99); 9 Dec 2009 17:13:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Dec 2009 17:13:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Dec 2009 17:13:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DC1E923888FD; Wed, 9 Dec 2009 17:13:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r888877 - in /commons/proper/jexl/trunk: ./ src/main/java/org/apache/commons/jexl2/ src/main/java/org/apache/commons/jexl2/introspection/ src/main/java/org/apache/commons/jexl2/parser/ src/main/java/org/apache/commons/jexl2/scripting/ src/m... Date: Wed, 09 Dec 2009 17:13:10 -0000 To: commits@commons.apache.org From: henrib@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091209171310.DC1E923888FD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: henrib Date: Wed Dec 9 17:13:09 2009 New Revision: 888877 URL: http://svn.apache.org/viewvc?rev=888877&view=rev Log: document separation between user land & non-public code; reduced dependency between Interpreter & non-public code Modified: commons/proper/jexl/trunk/pom.xml commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/package.html commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html commons/proper/jexl/trunk/src/site/site.xml commons/proper/jexl/trunk/xdocs/index.xml Modified: commons/proper/jexl/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/pom.xml?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/pom.xml (original) +++ commons/proper/jexl/trunk/pom.xml Wed Dec 9 17:13:09 2009 @@ -235,7 +235,7 @@ org/apache/commons/jexl2/parser/*.class - apache/commons/jexl2/**/*Test.class + org/apache/commons/jexl2/**/*Test.class @@ -245,6 +245,10 @@ findbugs-maven-plugin 2.1 + + org/apache/commons/jexl2/parser/*.class + org/apache/commons/jexl2/**/*Test.class + true target/site @@ -257,7 +261,8 @@ 1.5 - org/apache/commons/jexl/parser/*.java + org/apache/commons/jexl2/parser/*.class + org/apache/commons/jexl2/**/*Test.class /rulesets/braces.xml Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java Wed Dec 9 17:13:09 2009 @@ -78,7 +78,6 @@ import org.apache.commons.jexl2.parser.Node; import org.apache.commons.jexl2.parser.ParserVisitor; -import org.apache.commons.jexl2.util.AbstractExecutor; import org.apache.commons.jexl2.introspection.Uberspect; import org.apache.commons.jexl2.introspection.JexlMethod; import org.apache.commons.jexl2.introspection.JexlPropertyGet; @@ -765,10 +764,10 @@ // attempt to reuse last executor cached in volatile JexlNode.value if (cache) { Object cached = node.jjtGetValue(); - if (cached instanceof AbstractExecutor.Method) { - AbstractExecutor.Method me = (AbstractExecutor.Method) cached; - Object eval = me.tryExecute(methodName, data, argv); - if (eval != AbstractExecutor.TRY_FAILED) { + if (cached instanceof JexlMethod) { + JexlMethod me = (JexlMethod) cached; + Object eval = me.tryInvoke(methodName, data, argv); + if (!me.tryFailed(eval)) { return eval; } } @@ -857,10 +856,10 @@ // attempt to reuse last executor cached in volatile JexlNode.value if (cache) { Object cached = node.jjtGetValue(); - if (cached instanceof AbstractExecutor.Method) { - AbstractExecutor.Method me = (AbstractExecutor.Method) cached; - Object eval = me.tryExecute(function, namespace, argv); - if (eval != AbstractExecutor.TRY_FAILED) { + if (cached instanceof JexlMethod) { + JexlMethod me = (JexlMethod) cached; + Object eval = me.tryInvoke(function, namespace, argv); + if (!me.tryFailed(eval)) { return eval; } } @@ -1157,10 +1156,10 @@ // attempt to reuse last executor cached in volatile JexlNode.value if (node != null && cache) { Object cached = node.jjtGetValue(); - if (cached instanceof AbstractExecutor.Get) { - AbstractExecutor.Get vg = (AbstractExecutor.Get) cached; - Object value = vg.tryExecute(object, attribute); - if (value != AbstractExecutor.TRY_FAILED) { + if (cached instanceof JexlPropertyGet) { + JexlPropertyGet vg = (JexlPropertyGet) cached; + Object value = vg.tryInvoke(object, attribute); + if (!vg.tryFailed(value)) { return value; } } @@ -1217,10 +1216,10 @@ // attempt to reuse last executor cached in volatile JexlNode.value if (node != null && cache) { Object cached = node.jjtGetValue(); - if (cached instanceof AbstractExecutor.Set) { - AbstractExecutor.Set setter = (AbstractExecutor.Set) cached; - Object eval = setter.tryExecute(object, attribute, value); - if (eval != AbstractExecutor.TRY_FAILED) { + if (cached instanceof JexlPropertySet) { + JexlPropertySet setter = (JexlPropertySet) cached; + Object eval = setter.tryInvoke(object, attribute, value); + if (!setter.tryFailed(eval)) { return; } } Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java Wed Dec 9 17:13:09 2009 @@ -123,7 +123,7 @@ } if (val instanceof String) { String string = (String) val; - return string.indexOf(".") != -1 || string.indexOf("e") != -1 || string.indexOf("E") != -1; + return string.indexOf('.') != -1 || string.indexOf('e') != -1 || string.indexOf('E') != -1; } return false; } Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java Wed Dec 9 17:13:09 2009 @@ -849,7 +849,7 @@ se = stack[s]; String className = se.getClassName(); if (!className.equals(clazz.getName())) { - // go deeper if called from JexlEngine, UnifiedJEXL or a Factory + // go deeper if called from JexlEngine or UnifiedJEXL if (className.equals(JexlEngine.class.getName())) { clazz = JexlEngine.class; } else if (className.equals(UnifiedJEXL.class.getName())) { Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java Wed Dec 9 17:13:09 2009 @@ -30,7 +30,7 @@ */ public interface JexlMethod { /** - * invocation method - called when the method invocation should be performed + * Invocation method, called when the method invocation should be performed * and a value returned. * @param obj the object @@ -39,7 +39,25 @@ * @throws Exception on any error. */ Object invoke(Object obj, Object[] params) throws Exception; - + + /** + * Attempts to reuse this JexlMethod, checking that it is compatible with + * the actual set of arguments. + * @param obj the object to invoke the method upon + * @param name the method name + * @param params the method arguments + * @return the result of the method invocation that should be checked by tryFailed to determine if it succeeded + * or failed. + */ + Object tryInvoke(String name, Object obj, Object[] params); + + /** + * Checks wether a tryExecute failed or not. + * @param rval the value returned by tryInvoke + * @return true if tryInvoke failed, false otherwise + */ + boolean tryFailed(Object rval); + /** * specifies if this JexlMethod is cacheable and able to be reused for this * class of object it was returned for. @@ -49,12 +67,6 @@ boolean isCacheable(); /** - * Gets the method name used. - * @return method name - */ - String getMethodName(); - - /** * returns the return type of the method invoked. * @return return type */ Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java Wed Dec 9 17:13:09 2009 @@ -29,15 +29,32 @@ */ public interface JexlPropertyGet { /** - * invocation method - called when the 'get action' should be performed and - * a value returned. - * @param obj the object to get the property from. + * Method used to get the property value of an object. + * + * @param obj the object to get the property value from. * @return the property value. * @throws Exception on any error. */ Object invoke(Object obj) throws Exception; /** + * Attempts to reuse this JexlPropertyGet, checking that it is compatible with + * the actual set of arguments. + * @param obj the object to invoke the property get upon + * @param key the property key to get + * @return the result of the method invocation that should be checked by tryFailed to determine if it succeeded + * or failed. + */ + Object tryInvoke(Object obj, Object key); + + /** + * Checks wether a tryExecute failed or not. + * @param rval the value returned by tryInvoke + * @return true if tryInvoke failed, false otherwise + */ + boolean tryFailed(Object rval); + + /** * Specifies if this JexlPropertyGet is cacheable and able to be reused for * this class of object it was returned for. * @@ -46,12 +63,6 @@ boolean isCacheable(); /** - * returns the method name used to return this 'property'. - * @return the method name. - */ - String getMethodName(); - - /** * Tell whether the method underlying this 'property' is alive by * checking to see if represents a successful name resolution. * Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java Wed Dec 9 17:13:09 2009 @@ -29,26 +29,39 @@ */ public interface JexlPropertySet { /** - * method used to set the value in the object. + * Method used to set the property value of an object. * - * @param o Object on which the method will be called with the arg + * @param obj Object on which the property setter will be called with the value * @param arg value to be set * @return the value returned from the set operation (impl specific) * @throws Exception on any error. */ - Object invoke(Object o, Object arg) throws Exception; + Object invoke(Object obj, Object arg) throws Exception; /** - * specifies if this JexlPropertySet is cacheable and able to be reused for + * Attempts to reuse this JexlPropertySet, checking that it is compatible with + * the actual set of arguments. + * @param obj the object to invoke the the get upon + * @param key the property key to get + * @param value the property value to set + * @return the result of the method invocation that should be checked by tryFailed to determine if it succeeded + * or failed. + */ + Object tryInvoke(Object obj, Object key, Object value); + + /** + * Checks wether a tryInvoke failed or not. + * @param rval the value returned by tryInvoke + * @return true if tryExecute failed, false otherwise + */ + boolean tryFailed(Object rval); + + /** + * Specifies if this JexlPropertySet is cacheable and able to be reused for * this class of object it was returned for. * * @return true if can be reused for this class, false if not */ boolean isCacheable(); - /** - * returns the method name used to set this 'property'. - * @return the method name. - */ - String getMethodName(); } Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html Wed Dec 9 17:13:09 2009 @@ -1,35 +1,34 @@ - - - Package Documentation for org.apache.commons.jexl2.introspection Package - - - Provides high-level introspective services. -
-

- The Uberspect, JexlMethod, JexlPropertyGet and JexlPropertySet interfaces - form the exposed face of introspective services. -

-

- The Uberspectimpl is the concrete class implementing the Uberspect interface. - Deriving from this class is the preferred way of augmenting Jexl introspective - capabilities when special needs to be fullfilled or when default behaviors - need to be modified. -

- + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + + Package Documentation for org.apache.commons.jexl2.introspection Package + + +

Provides high-level introspective services.

+

+ The Uberspect, JexlMethod, JexlPropertyGet and JexlPropertySet interfaces + form the exposed face of introspective services. +

+

+ The Uberspectimpl is the concrete class implementing the Uberspect interface. + Deriving from this class is the preferred way of augmenting Jexl introspective + capabilities when special needs to be fullfilled or when default behaviors + need to be modified. +

+ Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html Wed Dec 9 17:13:09 2009 @@ -43,11 +43,10 @@ {@link org.apache.commons.jexl2.JexlContext}. An Expression is created using {@link org.apache.commons.jexl2.JexlEngine#createExpression(java.lang.String)}, - passing a String containing valid JEXL syntax. A JexlContext is created using - {@link org.apache.commons.jexl2.JexlHelper#createContext()}, - and variables are put into a map exposed through the - {@link org.apache.commons.jexl2.JexlContext#getVars()} - method on JexlContext. The following example, takes a variable named foo, and + passing a String containing valid JEXL syntax. A simple JexlContext can be created using + a {@link org.apache.commons.jexl2.MapContext} instance; + a map of variables that will be internally wrapped can be optionally provided through its constructor. + The following example, takes a variable named foo, and invokes the bar() method on the property innerFoo:

@@ -58,13 +57,14 @@
             Expression e = jexl.createExpression( jexlExp );
 
             // Create a context and add data
-            JexlContext jc = new JexlContext.Mapped();
+            JexlContext jc = new MapContext();
             jc.set("foo", new Foo() );
 
             // Now evaluate the expression, getting the result
             Object o = e.evaluate(jc);
         
+

Using JEXL

The API is composed of three levels addressing different functional needs:
    @@ -73,6 +73,23 @@
  • JSP/JSF like expression known as UnifiedJEXL expressions
+

Important note

+ The only public packages you should use are: +
    +
  • org.apache.commons.jexl2
  • +
  • org.apache.commons.jexl2.introspection
  • +
+ The following packages follow a "use at your own maintenance cost" policy. + Their classes and methods are not guaranteed to remain compatible in subsequent versions. + If you think you need to use some of their features, it might be a good idea to check with + the community through the mailing list first. +
    +
  • org.apache.commons.jexl2.parser
  • +
  • org.apache.commons.jexl2.scripting
  • +
  • org.apache.commons.jexl2.util
  • +
  • org.apache.commons.jexl2.util.introspection
  • +
+

Dynamic invocation

These functionalities are close to the core level utilities found in @@ -134,7 +151,7 @@

             JexlEngine jexl = nex JexlEngine();
 
-            JexlContext jc = new JexlContext.Mapped();
+            JexlContext jc = new MapContext();
             jc.set("quuxClass", quux.class);
 
             Expression create = jexl.createExpression("quux = new(quuxClass, 'xuuq', 100)");
@@ -219,7 +236,7 @@
             JexlEngine jexl = new JexlEngine();
             jexl.setFunctions(funcs);
 
-            JexlContext jc = new JexlContext.Mapped();
+            JexlContext jc = new MapContext();
             jc.set("pi", Math.PI);
 
             e = JEXL.createExpression("math:cos(pi)");
@@ -249,7 +266,7 @@
             for variable contexts or add factory based support to the 'new' operator.
         

- {@link org.apache.commons.jexl2.util.introspection.UberspectImpl} + {@link org.apache.commons.jexl2.introspection.UberspectImpl} is the class to derive if you need to add introspection or reflection capabilities for some objects. For instance, being able to expose and manipulate public fields instead of Java-beans conventions.

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/package.html URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/package.html?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/package.html (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/package.html Wed Dec 9 17:13:09 2009 @@ -1,34 +1,31 @@ - - - Package Documentation for org.apache.commons.jexl2.parser Package - - - Contains the Parser for JEXL script. -

-

-

-

-

Introduction

-

- This package contains the Parser for JEXL script. -

- + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + + Package Documentation for org.apache.commons.jexl2.parser Package + + +

+ Contains the Parser for JEXL script. +

+

+ This internal package is not intended for public usage and there is no + guarantee that its public classes or methods will remain as is in subsequent + versions. +

+ Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html Wed Dec 9 17:13:09 2009 @@ -1,34 +1,31 @@ - - - Package Documentation for org.apache.commons.jexl2.scripting Package - - - Contains the JSR-223 Scripting Engine for JEXL script. -

-

-

-

-

Introduction

-

- This package contains the JSR-223 Scripting Engine for JEXL script. -

- + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + + Package Documentation for org.apache.commons.jexl2.scripting Package + + +

+ Contains the JSR-223 Scripting Engine for JEXL script. +

+

+ This internal package is not intended for public usage and there is no + guarantee that its public classes or methods will remain as is in subsequent + versions. +

+ Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java Wed Dec 9 17:13:09 2009 @@ -171,6 +171,16 @@ return method.getName(); } + + /** + * Checks wether a tryExecute failed or not. + * @param exec the value returned by tryExecute + * @return true if tryExecute failed, false otherwise + */ + public final boolean tryFailed(Object exec) { + return exec == TRY_FAILED; + } + /** * Abstract class that is used to execute an arbitrary 'get' method. */ @@ -188,6 +198,11 @@ public final Object invoke(Object obj) throws Exception { return execute(obj); } + + /** {@inheritDoc} */ + public final Object tryInvoke(Object obj, Object key) { + return tryExecute(obj, key); + } /** * Gets the property value from an object. @@ -232,10 +247,15 @@ } /** {@inheritDoc} */ - public Object invoke(Object obj, Object arg) throws Exception { + public final Object invoke(Object obj, Object arg) throws Exception { return execute(obj, arg); } + /** {@inheritDoc} */ + public final Object tryInvoke(Object obj, Object key, Object value) { + return tryExecute(obj, key, value); + } + /** * Sets the property value of an object. * @@ -311,6 +331,11 @@ } /** {@inheritDoc} */ + public final Object tryInvoke(String name, Object obj, Object[] params) { + return tryExecute(name, obj, params); + } + + /** {@inheritDoc} */ @Override public Object getTargetProperty() { return key; @@ -342,7 +367,7 @@ * @param obj the object to invoke the method upon * @param name the method name * @param args the method arguments - * @return the result of the method invocation or INVOKE_FAILED if checking failed. + * @return the result of the method invocation or TRY_FAILED if checking failed. */ public Object tryExecute(String name, Object obj, Object[] args){ return TRY_FAILED; Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html Wed Dec 9 17:13:09 2009 @@ -1,36 +1,39 @@ - - - Package Documentation for org.apache.commons.jexl2.introspection Package - - - Provides low-level introspective services. -
-

Low level

-

- The IntrospectorBase, ClassMap, MethodKey, MethodMap form the - base of the introspection service. They allow to describe classes and their - methods, keeping them in a cache (@see IntrospectorBase) to speed up property - getters/setters and method discovery used during expression evaluation. -

-

- The cache materialized in Introspector creates one entry per class containing a map of all - accessible public methods keyed by name and signature. -

- + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + + Package Documentation for org.apache.commons.jexl2.introspection Package + + + Provides low-level introspective services. +

+ This internal package is not intended for public usage and there is no + guarantee that its public classes or methods will remain as is in subsequent + versions. +

+

+ The IntrospectorBase, ClassMap, MethodKey, MethodMap form the + base of the introspection service. They allow to describe classes and their + methods, keeping them in a cache (@see IntrospectorBase) to speed up property + getters/setters and method discovery used during expression evaluation. +

+

+ The cache materialized in Introspector creates one entry per class containing a map of all + accessible public methods keyed by name and signature. +

+ Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html Wed Dec 9 17:13:09 2009 @@ -1,33 +1,37 @@ - - - Package Documentation for org.apache.commons.jexl2 Package - - - Provides utilities for introspection services. -

-

- This set of classes implement the various forms of setters and getters - used by Jexl. These are specialized forms for 'pure' properties, discovering - methods of the {s,g}etProperty form, for Maps, Lists and Ducks - - attempting to discover a 'get' or 'set' method, making an object walk and - quack. -

- - + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> + + Package Documentation for org.apache.commons.jexl2 Package + + +

Provides utilities for introspection services.

+

+ This internal package is not intended for public usage and there is no + guarantee that its public classes or methods will remain as is in subsequent + versions. +

+

+ This set of classes implement the various forms of setters and getters + used by Jexl. These are specialized forms for 'pure' properties, discovering + methods of the {s,g}etProperty form, for Maps, Lists and Ducks - + attempting to discover a 'get' or 'set' method, making an object walk and + quack. +

+ + Modified: commons/proper/jexl/trunk/src/site/site.xml URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/site/site.xml?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/site/site.xml (original) +++ commons/proper/jexl/trunk/src/site/site.xml Wed Dec 9 17:13:09 2009 @@ -18,26 +18,26 @@ Commons JEXL - /images/jexl-logo-white.png - /index.html + images/jexl-logo-white.png + index.html - - - - + + + + - + - - - - + + + + Modified: commons/proper/jexl/trunk/xdocs/index.xml URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/xdocs/index.xml?rev=888877&r1=888876&r2=888877&view=diff ============================================================================== --- commons/proper/jexl/trunk/xdocs/index.xml (original) +++ commons/proper/jexl/trunk/xdocs/index.xml Wed Dec 9 17:13:09 2009 @@ -85,17 +85,15 @@

When evaluating expressions, JEXL merges an - Expression + Expression with a - JexlContext. + JexlContext. An Expression is created using - ExpressionFactory.createExpression(), - passing a String containing valid JEXL syntax. A JexlContext is created using - new JexlContext.Mapped(), - and variables are put into a map exposed through the - getVars() - method on JexlContext. The following example, takes a variable named foo, and - invokes the bar() method on the property innerFoo: + ExpressionFactory.createExpression(), + passing a String containing valid JEXL syntax. A JexlContext can be created using a + new MapContext.Mapped(); + a map of variables that will be internally wrapped can be optionally provided through its constructor. + The following example, takes a variable named foo, and invokes the bar() method on the property innerFoo: