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 2017/03/10 14:43:36 UTC
svn commit: r1786353 -
/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlExpression.java
Author: henrib
Date: Fri Mar 10 14:43:35 2017
New Revision: 1786353
URL: http://svn.apache.org/viewvc?rev=1786353&view=rev
Log:
JEXL-211:
Add callable method to JexlExpression interface - breaks compatibility but it is not expected than any codeimplements this interface besides Jexl
Modified:
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlExpression.java
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlExpression.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlExpression.java?rev=1786353&r1=1786352&r2=1786353&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlExpression.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlExpression.java Fri Mar 10 14:43:35 2017
@@ -17,6 +17,8 @@
package org.apache.commons.jexl3;
+import java.util.concurrent.Callable;
+
/**
* Represents a single JEXL expression.
* <p>
@@ -33,7 +35,6 @@ package org.apache.commons.jexl3;
* @since 1.0
*/
public interface JexlExpression {
-
/**
* Evaluates the expression with the variables contained in the
* supplied {@link JexlContext}.
@@ -46,15 +47,27 @@ public interface JexlExpression {
/**
* Returns the source text of this expression.
- *
+ *
* @return the source text
*/
String getSourceText();
/**
- * Recreates the source text of this expression from the internal synactic tree.
- *
+ * Recreates the source text of this expression from the internal syntactic tree.
+ *
* @return the source text
*/
String getParsedText();
+
+ /**
+ * Creates a Callable from this expression.
+ *
+ * <p>This allows to submit it to an executor pool and provides support for asynchronous calls.</p>
+ * <p>The interpreter will handle interruption/cancellation gracefully if needed.</p>
+ *
+ * @param context the context
+ * @return the callable
+ * @since 3.1
+ */
+ Callable<Object> callable(JexlContext context);
}