|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java.javadoc 2011-12-19 06:15:00.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/ExpressionImpl.java 2015-04-15 19:05:24.054352570 -0600
|
|
|
2fde85 |
@@ -32,7 +32,7 @@ public class ExpressionImpl implements E
|
|
|
2fde85 |
/** The engine for this expression. */
|
|
|
2fde85 |
protected final JexlEngine jexl;
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
- * Original expression stripped from leading & trailing spaces.
|
|
|
2fde85 |
+ * Original expression stripped from leading & trailing spaces.
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
protected final String expression;
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
@@ -171,4 +171,4 @@ public class ExpressionImpl implements E
|
|
|
2fde85 |
};
|
|
|
2fde85 |
}
|
|
|
2fde85 |
|
|
|
2fde85 |
-}
|
|
|
2fde85 |
\ No newline at end of file
|
|
|
2fde85 |
+}
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java.javadoc 2011-12-19 06:15:01.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java 2015-04-15 19:05:24.055352589 -0600
|
|
|
2fde85 |
@@ -31,7 +31,7 @@ import org.apache.commons.logging.Log;
|
|
|
2fde85 |
* This basic function of this class is to return a Method object for a
|
|
|
2fde85 |
* particular class given the name of a method and the parameters to the method
|
|
|
2fde85 |
* in the form of an Object[]
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
* The first time the Introspector sees a class it creates a class method map
|
|
|
2fde85 |
* for the class in question. Basically the class method map is a Hastable where
|
|
|
2fde85 |
* Method objects are keyed by a concatenation of the method name and the names
|
|
|
2fde85 |
@@ -324,4 +324,4 @@ public class IntrospectorBase {
|
|
|
2fde85 |
return classMap;
|
|
|
2fde85 |
}
|
|
|
2fde85 |
}
|
|
|
2fde85 |
-}
|
|
|
2fde85 |
\ No newline at end of file
|
|
|
2fde85 |
+}
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodKey.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodKey.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodKey.java.javadoc 2011-12-19 06:15:01.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/introspection/MethodKey.java 2015-04-15 19:05:24.055352589 -0600
|
|
|
2fde85 |
@@ -40,7 +40,7 @@ import java.util.Arrays;
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* A key can be constructed either from arguments (array of objects) or from parameters
|
|
|
2fde85 |
* (array of class).
|
|
|
2fde85 |
- * Roughly 3x faster than string key to access the map & uses less memory.
|
|
|
2fde85 |
+ * Roughly 3x faster than string key to access the map & uses less memory.
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
public final class MethodKey {
|
|
|
2fde85 |
/** The hash code. */
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/Introspector.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/Introspector.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/Introspector.java.javadoc 2011-12-19 06:15:01.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/internal/Introspector.java 2015-04-15 19:05:24.055352589 -0600
|
|
|
2fde85 |
@@ -28,11 +28,11 @@ import org.apache.commons.logging.Log;
|
|
|
2fde85 |
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
* Default introspection services.
|
|
|
2fde85 |
- * Finding methods as well as property getters & setters.
|
|
|
2fde85 |
+ * Finding methods as well as property getters & setters.
|
|
|
2fde85 |
* @since 1.0
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
public class Introspector {
|
|
|
2fde85 |
- /** The logger to use for all warnings & errors. */
|
|
|
2fde85 |
+ /** The logger to use for all warnings & errors. */
|
|
|
2fde85 |
protected final Log rlog;
|
|
|
2fde85 |
/** The soft reference to the introspector currently in use. */
|
|
|
2fde85 |
private volatile SoftReference<IntrospectorBase> ref;
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java.javadoc 2011-12-19 06:14:59.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java 2015-04-15 19:34:32.872928036 -0600
|
|
|
2fde85 |
@@ -26,6 +26,7 @@ import java.util.Set;
|
|
|
2fde85 |
* through "whitelists" and "blacklists".
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* A whitelist explicitly allows methods/properties for a class;
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* If a whitelist is empty and thus does not contain any names, all properties/methods are allowed for its class.
|
|
|
2fde85 |
@@ -34,9 +35,9 @@ import java.util.Set;
|
|
|
2fde85 |
* If it is not empty, the only allowed properties/methods are the ones contained.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* A blacklist explicitly forbids methods/properties for a class;
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* If a blacklist is empty and thus does not contain any names, all properties/methods are forbidden for its class.
|
|
|
2fde85 |
@@ -47,12 +48,12 @@ import java.util.Set;
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* Permissions are composed of three lists, read, write, execute, each being "white" or "black":
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* read controls readable properties
|
|
|
2fde85 |
* write controls writeable properties
|
|
|
2fde85 |
* execute controls executable methods and constructor
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
* @since 2.1
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
public final class Sandbox {
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java.javadoc 2011-12-19 06:14:59.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java 2015-04-15 19:53:47.277461744 -0600
|
|
|
2fde85 |
@@ -26,6 +26,7 @@ import java.math.MathContext;
|
|
|
2fde85 |
* Perform arithmetic.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* All arithmetic operators (+, - , *, /, %) follow the same rules regarding their arguments.
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* If both are null, result is 0
|
|
|
2fde85 |
* If either is a BigDecimal, coerce both to BigDecimal and and perform operation
|
|
|
2fde85 |
@@ -39,7 +40,6 @@ import java.math.MathContext;
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
* Note that the only exception throw by JexlArithmetic is ArithmeticException.
|
|
|
2fde85 |
* @since 2.0
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
@@ -630,7 +630,7 @@ public class JexlArithmetic {
|
|
|
2fde85 |
* Performs a bitwise and.
|
|
|
2fde85 |
* @param left the left operand
|
|
|
2fde85 |
* @param right the right operator
|
|
|
2fde85 |
- * @return left & right
|
|
|
2fde85 |
+ * @return left & right
|
|
|
2fde85 |
* @since 2.1
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
public Object bitwiseAnd(Object left, Object right) {
|
|
|
2fde85 |
@@ -681,7 +681,7 @@ public class JexlArithmetic {
|
|
|
2fde85 |
* @param left the left operand
|
|
|
2fde85 |
* @param right the right operator
|
|
|
2fde85 |
* @param operator the operator
|
|
|
2fde85 |
- * @return -1 if left < right; +1 if left > > right; 0 if left == right
|
|
|
2fde85 |
+ * @return -1 if left < right; +1 if left > right; 0 if left == right
|
|
|
2fde85 |
* @throws ArithmeticException if either left or right is null
|
|
|
2fde85 |
* @since 2.1
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
@@ -761,7 +761,7 @@ public class JexlArithmetic {
|
|
|
2fde85 |
}
|
|
|
2fde85 |
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
- * Test if left < right.
|
|
|
2fde85 |
+ * Test if left < right.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* @param left first value
|
|
|
2fde85 |
* @param right second value
|
|
|
2fde85 |
@@ -777,7 +777,7 @@ public class JexlArithmetic {
|
|
|
2fde85 |
}
|
|
|
2fde85 |
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
- * Test if left > right.
|
|
|
2fde85 |
+ * Test if left > right.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* @param left first value
|
|
|
2fde85 |
* @param right second value
|
|
|
2fde85 |
@@ -792,7 +792,7 @@ public class JexlArithmetic {
|
|
|
2fde85 |
}
|
|
|
2fde85 |
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
- * Test if left <= right.
|
|
|
2fde85 |
+ * Test if left ≤ right.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* @param left first value
|
|
|
2fde85 |
* @param right second value
|
|
|
2fde85 |
@@ -809,7 +809,7 @@ public class JexlArithmetic {
|
|
|
2fde85 |
}
|
|
|
2fde85 |
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
- * Test if left >= right.
|
|
|
2fde85 |
+ * Test if left ≥ right.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* @param left first value
|
|
|
2fde85 |
* @param right second value
|
|
|
2fde85 |
@@ -1141,4 +1141,4 @@ public class JexlArithmetic {
|
|
|
2fde85 |
}
|
|
|
2fde85 |
return result;
|
|
|
2fde85 |
}
|
|
|
2fde85 |
-}
|
|
|
2fde85 |
\ No newline at end of file
|
|
|
2fde85 |
+}
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/JexlEngine.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/JexlEngine.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/JexlEngine.java.javadoc 2011-12-19 06:15:00.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/JexlEngine.java 2015-04-15 19:29:36.837248669 -0600
|
|
|
2fde85 |
@@ -53,14 +53,14 @@ import org.apache.commons.jexl2.parser.A
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* Creates and evaluates Expression and Script objects.
|
|
|
2fde85 |
- * Determines the behavior of Expressions & Scripts during their evaluation with respect to:
|
|
|
2fde85 |
+ * Determines the behavior of Expressions & Scripts during their evaluation with respect to:
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* Introspection, see {@link Uberspect}
|
|
|
2fde85 |
- * Arithmetic & comparison, see {@link JexlArithmetic}
|
|
|
2fde85 |
+ * Arithmetic & comparison, see {@link JexlArithmetic}
|
|
|
2fde85 |
* Error reporting
|
|
|
2fde85 |
* Logging
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
* The setSilent and setLenient methods allow to fine-tune an engine instance behavior
|
|
|
2fde85 |
* according to various error control needs. The lenient/strict flag tells the engine when and if null as operand is
|
|
|
2fde85 |
* considered an error, the silent/verbose flag tells the engine what to do with the error
|
|
|
2fde85 |
@@ -68,7 +68,7 @@ import org.apache.commons.jexl2.parser.A
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* When "silent" & "lenient":
|
|
|
2fde85 |
- * 0 & null should be indicators of "default" values so that even in an case of error,
|
|
|
2fde85 |
+ * 0 & null should be indicators of "default" values so that even in an case of error,
|
|
|
2fde85 |
* something meaningfull can still be inferred; may be convenient for configurations.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
@@ -84,7 +84,7 @@ import org.apache.commons.jexl2.parser.A
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* When "verbose" & "strict":
|
|
|
2fde85 |
* The finest error control grain is obtained; it is the closest to Java code -
|
|
|
2fde85 |
- * still augmented by "script" capabilities regarding automated conversions & type matching.
|
|
|
2fde85 |
+ * still augmented by "script" capabilities regarding automated conversions & type matching.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
@@ -872,7 +872,7 @@ public class JexlEngine {
|
|
|
2fde85 |
* Creates a cache.
|
|
|
2fde85 |
* @param <K> the key type
|
|
|
2fde85 |
* @param <V> the value type
|
|
|
2fde85 |
- * @param cacheSize the cache size, must be > 0
|
|
|
2fde85 |
+ * @param cacheSize the cache size, must be > 0
|
|
|
2fde85 |
* @return a Map usable as a cache bounded to the given size
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
protected <K, V> Map<K, V> createCache(final int cacheSize) {
|
|
|
2fde85 |
@@ -1312,7 +1312,7 @@ public class JexlEngine {
|
|
|
2fde85 |
}
|
|
|
2fde85 |
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
- * Trims the expression from front & ending spaces.
|
|
|
2fde85 |
+ * Trims the expression from front & ending spaces.
|
|
|
2fde85 |
* @param str expression to clean
|
|
|
2fde85 |
* @return trimmed expression ending in a semi-colon
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/parser/Parser.jjt.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/parser/Parser.jjt
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/parser/Parser.jjt.javadoc 2011-12-19 06:14:59.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/parser/Parser.jjt 2015-04-15 19:06:23.342339942 -0600
|
|
|
2fde85 |
@@ -62,7 +62,7 @@ PARSER_END(Parser)
|
|
|
2fde85 |
|
|
|
2fde85 |
|
|
|
2fde85 |
/***************************************
|
|
|
2fde85 |
- * Skip & Number literal tokens
|
|
|
2fde85 |
+ * Skip & Number literal tokens
|
|
|
2fde85 |
***************************************/
|
|
|
2fde85 |
|
|
|
2fde85 |
<*> SKIP : /* WHITE SPACE */
|
|
|
2fde85 |
@@ -145,7 +145,7 @@ PARSER_END(Parser)
|
|
|
2fde85 |
}
|
|
|
2fde85 |
|
|
|
2fde85 |
/***************************************
|
|
|
2fde85 |
- * Identifier & String tokens
|
|
|
2fde85 |
+ * Identifier & String tokens
|
|
|
2fde85 |
***************************************/
|
|
|
2fde85 |
|
|
|
2fde85 |
<*> TOKEN : /* IDENTIFIERS */
|
|
|
2fde85 |
@@ -275,7 +275,7 @@ void LValueVar() #Reference : {}
|
|
|
2fde85 |
}
|
|
|
2fde85 |
|
|
|
2fde85 |
/***************************************
|
|
|
2fde85 |
- * Conditional & relational
|
|
|
2fde85 |
+ * Conditional & relational
|
|
|
2fde85 |
***************************************/
|
|
|
2fde85 |
|
|
|
2fde85 |
void ConditionalExpression() #void : {}
|
|
|
2fde85 |
@@ -398,7 +398,7 @@ void UnaryExpression() #void : {}
|
|
|
2fde85 |
|
|
|
2fde85 |
|
|
|
2fde85 |
/***************************************
|
|
|
2fde85 |
- * Identifier & Literals
|
|
|
2fde85 |
+ * Identifier & Literals
|
|
|
2fde85 |
***************************************/
|
|
|
2fde85 |
|
|
|
2fde85 |
void Identifier(boolean top) :
|
|
|
2fde85 |
@@ -501,7 +501,7 @@ void MapEntry() : {}
|
|
|
2fde85 |
|
|
|
2fde85 |
|
|
|
2fde85 |
/***************************************
|
|
|
2fde85 |
- * Functions & Methods
|
|
|
2fde85 |
+ * Functions & Methods
|
|
|
2fde85 |
***************************************/
|
|
|
2fde85 |
|
|
|
2fde85 |
void EmptyFunction() : {}
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngineFactory.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngineFactory.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngineFactory.java.javadoc 2011-12-19 06:15:00.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngineFactory.java 2015-04-15 19:05:24.058352644 -0600
|
|
|
2fde85 |
@@ -29,9 +29,9 @@ import org.apache.commons.jexl2.parser.S
|
|
|
2fde85 |
/**
|
|
|
2fde85 |
* Implements the Jexl ScriptEngineFactory for JSF-223.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- * Supports the following:<br.>
|
|
|
2fde85 |
- * Language short names: "JEXL", "Jexl", "jexl", "JEXL2", "Jexl2", "jexl2"
|
|
|
2fde85 |
- * File Extensions: ".jexl", ".jexl2"
|
|
|
2fde85 |
+ * Supports the following:
|
|
|
2fde85 |
+ * Language short names: "JEXL", "Jexl", "jexl", "JEXL2", "Jexl2", "jexl2"
|
|
|
2fde85 |
+ * File Extensions: ".jexl", ".jexl2"
|
|
|
2fde85 |
* "jexl2" etc. were added for engineVersion="2.0".
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngine.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngine.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngine.java.javadoc 2011-12-19 06:15:00.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngine.java 2015-04-15 19:33:18.303497441 -0600
|
|
|
2fde85 |
@@ -95,6 +95,7 @@ public class JexlScriptEngine extends Ab
|
|
|
2fde85 |
* Those properties are allways bound to the default engine scope context.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* The following properties are defined:
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* in - refers to the engine scope reader that defaults to reading System.err
|
|
|
2fde85 |
* out - refers the engine scope writer that defaults to writing in System.out
|
|
|
2fde85 |
@@ -102,7 +103,6 @@ public class JexlScriptEngine extends Ab
|
|
|
2fde85 |
* logger - the JexlScriptEngine logger
|
|
|
2fde85 |
* System - the System.class
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
* @since 2.0
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
public class JexlScriptObject {
|
|
|
2fde85 |
diff -up commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java.javadoc commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java
|
|
|
2fde85 |
--- commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java.javadoc 2011-12-19 06:14:58.000000000 -0700
|
|
|
2fde85 |
+++ commons-jexl-2.1.1-src/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java 2015-04-15 19:51:40.950152677 -0600
|
|
|
2fde85 |
@@ -38,21 +38,21 @@ import org.apache.commons.jexl2.parser.S
|
|
|
2fde85 |
* and facilitate the implementation of expression evaluation.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* An expression can mix immediate, deferred and nested sub-expressions as well as string constants;
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* The "immediate" syntax is of the form "...${jexl-expr}..."
|
|
|
2fde85 |
* The "deferred" syntax is of the form "...#{jexl-expr}..."
|
|
|
2fde85 |
* The "nested" syntax is of the form "...#{...${jexl-expr0}...}..."
|
|
|
2fde85 |
* The "composite" syntax is of the form "...${jexl-expr0}... #{jexl-expr1}..."
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- * Deferred & immediate expression carry different intentions:
|
|
|
2fde85 |
+ * Deferred & immediate expression carry different intentions:
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* An immediate expression indicate that evaluation is intended to be performed close to
|
|
|
2fde85 |
* the definition/parsing point.
|
|
|
2fde85 |
* A deferred expression indicate that evaluation is intended to occur at a later stage.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* For instance: "Hello ${name}, now is #{time}" is a composite "deferred" expression since one
|
|
|
2fde85 |
* of its subexpressions is deferred. Furthermore, this (composite) expression intent is
|
|
|
2fde85 |
@@ -62,14 +62,14 @@ import org.apache.commons.jexl2.parser.S
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* The API reflects this feature in 2 methods, prepare and evaluate. The prepare method
|
|
|
2fde85 |
* will evaluate the immediate subexpression and return an expression that contains only
|
|
|
2fde85 |
- * the deferred subexpressions (& constants), a prepared expression. Such a prepared expression
|
|
|
2fde85 |
+ * the deferred subexpressions (& constants), a prepared expression. Such a prepared expression
|
|
|
2fde85 |
* is suitable for a later phase evaluation that may occur with a different JexlContext.
|
|
|
2fde85 |
* Note that it is valid to call evaluate without prepare in which case the same JexlContext
|
|
|
2fde85 |
* is used for the 2 evaluation phases.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* In the most common use-case where deferred expressions are to be kept around as properties of objects,
|
|
|
2fde85 |
- * one should parse & prepare an expression before storing it and evaluate it each time
|
|
|
2fde85 |
+ * one should parse & prepare an expression before storing it and evaluate it each time
|
|
|
2fde85 |
* the property storing it is accessed.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
@@ -339,7 +339,7 @@ public final class UnifiedJEXL {
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* In effect, this binds the result of the immediate sub-expressions evaluation in the
|
|
|
2fde85 |
* context, allowing to differ evaluation of the remaining (deferred) expression within another context.
|
|
|
2fde85 |
- * This only has an effect to nested & composite expressions that contain differed & immediate sub-expressions.
|
|
|
2fde85 |
+ * This only has an effect to nested & composite expressions that contain differed & immediate sub-expressions.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* If the underlying JEXL engine is silent, errors will be logged through its logger as warning.
|
|
|
2fde85 |
@@ -409,7 +409,7 @@ public final class UnifiedJEXL {
|
|
|
2fde85 |
* Prepares a sub-expression for interpretation.
|
|
|
2fde85 |
* @param interpreter a JEXL interpreter
|
|
|
2fde85 |
* @return a prepared expression
|
|
|
2fde85 |
- * @throws JexlException (only for nested & composite)
|
|
|
2fde85 |
+ * @throws JexlException (only for nested & composite)
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
protected Expression prepare(Interpreter interpreter) {
|
|
|
2fde85 |
return this;
|
|
|
2fde85 |
@@ -419,7 +419,7 @@ public final class UnifiedJEXL {
|
|
|
2fde85 |
* Intreprets a sub-expression.
|
|
|
2fde85 |
* @param interpreter a JEXL interpreter
|
|
|
2fde85 |
* @return the result of interpretation
|
|
|
2fde85 |
- * @throws JexlException (only for nested & composite)
|
|
|
2fde85 |
+ * @throws JexlException (only for nested & composite)
|
|
|
2fde85 |
*/
|
|
|
2fde85 |
protected abstract Object evaluate(Interpreter interpreter);
|
|
|
2fde85 |
}
|
|
|
2fde85 |
@@ -734,7 +734,7 @@ public final class UnifiedJEXL {
|
|
|
2fde85 |
}
|
|
|
2fde85 |
|
|
|
2fde85 |
/** Creates a a {@link UnifiedJEXL.Expression} from an expression string.
|
|
|
2fde85 |
- * Uses & fills up the expression cache if any.
|
|
|
2fde85 |
+ * Uses & fills up the expression cache if any.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* If the underlying JEXL engine is silent, errors will be logged through its logger as warnings.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
@@ -1010,20 +1010,23 @@ public final class UnifiedJEXL {
|
|
|
2fde85 |
* evaluation and their output gathered through a writer.
|
|
|
2fde85 |
* It is thus possible to use looping or conditional construct "around" expressions generating output.
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- * For instance:
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
+ * For instance:
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
* $$ for(var x : [1, 3, 5, 42, 169]) {
|
|
|
2fde85 |
* $$ if (x == 42) {
|
|
|
2fde85 |
* Life, the universe, and everything
|
|
|
2fde85 |
- * $$ } else if (x > 42) {
|
|
|
2fde85 |
+ * $$ } else if (x > 42) {
|
|
|
2fde85 |
* The value $(x} is over fourty-two
|
|
|
2fde85 |
* $$ } else {
|
|
|
2fde85 |
* The value ${x} is under fourty-two
|
|
|
2fde85 |
* $$ }
|
|
|
2fde85 |
* $$ }
|
|
|
2fde85 |
*
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
* Will evaluate as:
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
* The value 1 is under fourty-two
|
|
|
2fde85 |
* The value 3 is under fourty-two
|
|
|
2fde85 |
* The value 5 is under fourty-two
|
|
|
2fde85 |
@@ -1033,10 +1036,10 @@ public final class UnifiedJEXL {
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* During evaluation, the template context exposes its writer as '$jexl' which is safe to use in this case.
|
|
|
2fde85 |
* This allows writing directly through the writer without adding new-lines as in:
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
+ *
|
|
|
2fde85 |
* $$ for(var cell : cells) { $jexl.print(cell); $jexl.print(';') }
|
|
|
2fde85 |
*
|
|
|
2fde85 |
- *
|
|
|
2fde85 |
*
|
|
|
2fde85 |
* A template is expanded as one JEXL script and a list of UnifiedJEXL expressions; each UnifiedJEXL expression
|
|
|
2fde85 |
* being replace in the script by a call to jexl:print(expr) (the expr is in fact the expr number in the template).
|
|
|
2fde85 |
@@ -1461,4 +1464,4 @@ public final class UnifiedJEXL {
|
|
|
2fde85 |
public Template createTemplate(String source) {
|
|
|
2fde85 |
return new Template("$$", new StringReader(source), (String[]) null);
|
|
|
2fde85 |
}
|
|
|
2fde85 |
-}
|
|
|
2fde85 |
\ No newline at end of file
|
|
|
2fde85 |
+}
|