You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2015/12/08 16:34:28 UTC
svn commit: r1718634 [1/2] - in
/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3: ./
introspection/ scripting/
Author: ebourg
Date: Tue Dec 8 15:34:27 2015
New Revision: 1718634
URL: http://svn.apache.org/viewvc?rev=1718634&view=rev
Log:
Javadoc formatting
Modified:
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlBuilder.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlExpression.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlOperator.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JxltEngine.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlMethod.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertyGet.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertySet.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlUberspect.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngine.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngineFactory.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/Main.java
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlArithmetic.java Tue Dec 8 15:34:27 2015
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jexl3;
import org.apache.commons.jexl3.introspection.JexlMethod;
@@ -28,50 +29,60 @@ import java.util.regex.Pattern;
/**
* Perform arithmetic, implements JexlOperator methods.
- * <p>
- * This is the class to derive to implement new operator behaviors.
- * </p>
- * <p>
- * The 5 base arithmetic operators (+, - , *, /, %) follow the same evaluation rules regarding their arguments.
- * </p>
- * <ol>
- * <li>If both are null, result is 0</li>
- * <li>If either is a BigDecimal, coerce both to BigDecimal and perform operation</li>
- * <li>If either is a floating point number, coerce both to Double and perform operation</li>
- * <li>Else treat as BigInteger, perform operation and attempt to narrow result:
+ *
+ * <p>This is the class to derive to implement new operator behaviors.</p>
+ *
+ * <p>The 5 base arithmetic operators (+, - , *, /, %) follow the same evaluation rules regarding their arguments.</p>
* <ol>
- * <li>if both arguments can be narrowed to Integer, narrow result to Integer</li>
- * <li>if both arguments can be narrowed to Long, narrow result to Long</li>
- * <li>Else return result as BigInteger</li>
- * </ol>
- * </li>
+ * <li>If both are null, result is 0</li>
+ * <li>If either is a BigDecimal, coerce both to BigDecimal and perform operation</li>
+ * <li>If either is a floating point number, coerce both to Double and perform operation</li>
+ * <li>Else treat as BigInteger, perform operation and attempt to narrow result:
+ * <ol>
+ * <li>if both arguments can be narrowed to Integer, narrow result to Integer</li>
+ * <li>if both arguments can be narrowed to Long, narrow result to Long</li>
+ * <li>Else return result as BigInteger</li>
+ * </ol>
+ * </li>
* </ol>
+ *
* Note that the only exception thrown by JexlArithmetic is and must be ArithmeticException.
+ *
* @see JexlOperator
* @since 2.0
*/
public class JexlArithmetic {
+
/** Marker class for null operand exceptions. */
public static class NullOperand extends ArithmeticException {}
+
/** Double.MAX_VALUE as BigDecimal. */
protected static final BigDecimal BIGD_DOUBLE_MAX_VALUE = BigDecimal.valueOf(Double.MAX_VALUE);
+
/** Double.MIN_VALUE as BigDecimal. */
protected static final BigDecimal BIGD_DOUBLE_MIN_VALUE = BigDecimal.valueOf(Double.MIN_VALUE);
+
/** Long.MAX_VALUE as BigInteger. */
protected static final BigInteger BIGI_LONG_MAX_VALUE = BigInteger.valueOf(Long.MAX_VALUE);
+
/** Long.MIN_VALUE as BigInteger. */
protected static final BigInteger BIGI_LONG_MIN_VALUE = BigInteger.valueOf(Long.MIN_VALUE);
+
/** Default BigDecimal scale. */
protected static final int BIGD_SCALE = -1;
+
/** Whether this JexlArithmetic instance behaves in strict or lenient mode. */
protected final boolean strict;
+
/** The big decimal math context. */
protected final MathContext mathContext;
+
/** The big decimal scale. */
protected final int mathScale;
/**
* Creates a JexlArithmetic.
+ *
* @param astrict whether this arithmetic is strict or lenient
*/
public JexlArithmetic(boolean astrict) {
@@ -80,6 +91,7 @@ public class JexlArithmetic {
/**
* Creates a JexlArithmetic.
+ *
* @param astrict whether this arithmetic is lenient or strict
* @param bigdContext the math context instance to use for +,-,/,*,% operations on big decimals.
* @param bigdScale the scale used for big decimals.
@@ -92,6 +104,7 @@ public class JexlArithmetic {
/**
* Apply options to this arithmetic which eventually may create another instance.
+ *
* @param options the {@link JexlEngine.Options} to use
* @return an arithmetic with those options set
*/
@@ -118,11 +131,12 @@ public class JexlArithmetic {
/**
* The interface that uberspects JexlArithmetic classes.
- * <p>This allows overloaded operator methods discovery.
+ * <p>This allows overloaded operator methods discovery.</p>
*/
public interface Uberspect {
/**
* Checks whether this uberspect has overloads for a given operator.
+ *
* @param operator the operator to check
* @return true if an overload exists, false otherwise
*/
@@ -130,6 +144,7 @@ public class JexlArithmetic {
/**
* Gets the most specific method for an operator.
+ *
* @param operator the operator
* @param arg the arguments
* @return the most specific method or null if no specific override could be found
@@ -139,23 +154,28 @@ public class JexlArithmetic {
/**
* Helper interface used when creating an array literal.
+ *
* <p>The default implementation creates an array and attempts to type it strictly.</p>
+ *
* <ul>
- * <li>If all objects are of the same type, the array returned will be an array of that same type</li>
- * <li>If all objects are Numbers, the array returned will be an array of Numbers</li>
- * <li>If all objects are convertible to a primitive type, the array returned will be an array
- * of the primitive type</li>
+ * <li>If all objects are of the same type, the array returned will be an array of that same type</li>
+ * <li>If all objects are Numbers, the array returned will be an array of Numbers</li>
+ * <li>If all objects are convertible to a primitive type, the array returned will be an array
+ * of the primitive type</li>
* </ul>
*/
public interface ArrayBuilder {
+
/**
* Adds a literal to the array.
+ *
* @param value the item to add
*/
void add(Object value);
/**
* Creates the actual "array" instance.
+ *
* @param extended true when the last argument is ', ...'
* @return the array
*/
@@ -164,6 +184,7 @@ public class JexlArithmetic {
/**
* Called by the interpreter when evaluating a literal array.
+ *
* @param size the number of elements in the array
* @return the array builder
*/
@@ -178,12 +199,14 @@ public class JexlArithmetic {
public interface SetBuilder {
/**
* Adds a literal to the set.
+ *
* @param value the item to add
*/
void add(Object value);
/**
* Creates the actual "set" instance.
+ *
* @return the set
*/
Object create();
@@ -191,6 +214,7 @@ public class JexlArithmetic {
/**
* Called by the interpreter when evaluating a literal set.
+ *
* @param size the number of elements in the set
* @return the array builder
*/
@@ -205,6 +229,7 @@ public class JexlArithmetic {
public interface MapBuilder {
/**
* Adds a new entry to the map.
+ *
* @param key the map entry key
* @param value the map entry value
*/
@@ -212,6 +237,7 @@ public class JexlArithmetic {
/**
* Creates the actual "map" instance.
+ *
* @return the map
*/
Object create();
@@ -219,6 +245,7 @@ public class JexlArithmetic {
/**
* Called by the interpreter when evaluating a literal map.
+ *
* @param size the number of elements in the map
* @return the map builder
*/
@@ -229,6 +256,7 @@ public class JexlArithmetic {
/**
* Creates a literal range.
* <p>The default implementation only accepts integers and longs.</p>
+ *
* @param from the included lower bound value (null if none)
* @param to the included upper bound value (null if none)
* @return the range as an iterable
@@ -248,6 +276,7 @@ public class JexlArithmetic {
/**
* Checks whether this JexlArithmetic instance
* strictly considers null as an error when used as operand unexpectedly.
+ *
* @return true if strict, false if lenient
*/
public boolean isStrict() {
@@ -256,6 +285,7 @@ public class JexlArithmetic {
/**
* The MathContext instance used for +,-,/,*,% operations on big decimals.
+ *
* @return the math context
*/
public MathContext getMathContext() {
@@ -264,6 +294,7 @@ public class JexlArithmetic {
/**
* The BigDecimal scale used for comparison and coericion operations.
+ *
* @return the scale
*/
public int getMathScale() {
@@ -272,6 +303,7 @@ public class JexlArithmetic {
/**
* Ensure a big decimal is rounded by this arithmetic scale and rounding mode.
+ *
* @param number the big decimal to round
* @return the rounded big decimal
*/
@@ -286,6 +318,7 @@ public class JexlArithmetic {
/**
* The result of +,/,-,*,% when both operands are null.
+ *
* @return Integer(0) if lenient
* @throws ArithmeticException if strict
*/
@@ -298,6 +331,7 @@ public class JexlArithmetic {
/**
* Throw a NPE if arithmetic is strict.
+ *
* @throws ArithmeticException if strict
*/
protected void controlNullOperand() {
@@ -310,6 +344,7 @@ public class JexlArithmetic {
* The float regular expression pattern.
*/
public static final Pattern FLOAT_PATTERN = Pattern.compile("^[+-]?\\d*(\\.\\d*)?([eE]?[+-]?\\d*)?$");
+
/**
* Test if the passed value is a floating point number, i.e. a float, double
* or string with ( "." | "E" | "e").
@@ -379,6 +414,7 @@ public class JexlArithmetic {
/**
* Whether we consider the narrow class as a potential candidate for narrowing the source.
+ *
* @param narrow the target narrow class
* @param source the orginal source class
* @return true if attempt to narrow source to target is accepted
@@ -389,6 +425,7 @@ public class JexlArithmetic {
/**
* Given a Number, return back the value attempting to narrow it to a target class.
+ *
* @param original the original number
* @param narrow the attempted target class
* @return the narrowed number or the source if no narrowing was possible
@@ -465,6 +502,7 @@ public class JexlArithmetic {
* if either arguments is a BigInteger, no narrowing will occur
* if either arguments is a Long, no narrowing to Integer will occur
* </p>
+ *
* @param lhs the left hand side operand that lead to the bigi result
* @param rhs the right hand side operand that lead to the bigi result
* @param bigi the BigInteger to narrow
@@ -516,6 +554,7 @@ public class JexlArithmetic {
/**
* Replace all numbers in an arguments array with the smallest type that will fit.
+ *
* @param args the argument array
* @return true if some arguments were narrowed and args array is modified,
* false if no narrowing occurred and args array has not been modified
@@ -542,6 +581,7 @@ public class JexlArithmetic {
* If any numeric add fails on coercion to the appropriate type,
* treat as Strings and do concatenation.
* </p>
+ *
* @param left left argument
* @param right right argument
* @return left + right.
@@ -584,6 +624,7 @@ public class JexlArithmetic {
/**
* Divide the left value by the right.
+ *
* @param left left argument
* @param right right argument
* @return left / right
@@ -624,6 +665,7 @@ public class JexlArithmetic {
/**
* left value modulo right.
+ *
* @param left left argument
* @param right right argument
* @return left % right
@@ -664,6 +706,7 @@ public class JexlArithmetic {
/**
* Multiply the left value by the right.
+ *
* @param left left argument
* @param right right argument
* @return left * right.
@@ -694,6 +737,7 @@ public class JexlArithmetic {
/**
* Subtract the right value from the left.
+ *
* @param left left argument
* @param right right argument
* @return left - right.
@@ -724,6 +768,7 @@ public class JexlArithmetic {
/**
* Negates a value (unary minus for numbers).
+ *
* @param val the value to negate
* @return the negated value
*/
@@ -754,6 +799,7 @@ public class JexlArithmetic {
* Test if left contains right (right matches/in left).
* <p>Beware that this method arguments are the opposite of the operator arguments.
* 'x in y' means 'y contains x'.</p>
+ *
* @param container the container
* @param value the value
* @return test result or null if there is no arithmetic solution
@@ -887,6 +933,7 @@ public class JexlArithmetic {
/**
* Performs a bitwise and.
+ *
* @param left the left operand
* @param right the right operator
* @return left & right
@@ -899,6 +946,7 @@ public class JexlArithmetic {
/**
* Performs a bitwise or.
+ *
* @param left the left operand
* @param right the right operator
* @return left | right
@@ -911,6 +959,7 @@ public class JexlArithmetic {
/**
* Performs a bitwise xor.
+ *
* @param left the left operand
* @param right the right operator
* @return left ^ right
@@ -923,6 +972,7 @@ public class JexlArithmetic {
/**
* Performs a bitwise complement.
+ *
* @param val the operand
* @return ~val
*/
@@ -933,6 +983,7 @@ public class JexlArithmetic {
/**
* Performs a logical not.
+ *
* @param val the operand
* @return !val
*/
@@ -942,6 +993,7 @@ public class JexlArithmetic {
/**
* Performs a comparison.
+ *
* @param left the left operand
* @param right the right operator
* @param operator the operator
@@ -1275,6 +1327,7 @@ public class JexlArithmetic {
* Coerce to a primitive double.
* <p>Double.NaN, null and empty string coerce to zero.</p>
* <p>Boolean false is 0, true is 1.</p>
+ *
* @param val value to coerce.
* @return The double coerced value.
* @throws ArithmeticException if val is null and mode is strict or if coercion is not possible
@@ -1343,8 +1396,10 @@ public class JexlArithmetic {
public final Object bitwiseAnd(Object lhs, Object rhs) {
return and(lhs, rhs);
}
+
/**
* Use or overload or() instead.
+ *
* @param lhs left hand side
* @param rhs right hand side
* @return lhs | rhs
@@ -1358,6 +1413,7 @@ public class JexlArithmetic {
/**
* Use or overload xor() instead.
+ *
* @param lhs left hand side
* @param rhs right hand side
* @return lhs ^ rhs
@@ -1371,6 +1427,7 @@ public class JexlArithmetic {
/**
* Use or overload not() instead.
+ *
* @param arg argument
* @return !arg
* @see JexlArithmetic#not
@@ -1383,6 +1440,7 @@ public class JexlArithmetic {
/**
* Use or overload contains() instead.
+ *
* @param lhs left hand side
* @param rhs right hand side
* @return contains(rhs, lhs)
@@ -1393,5 +1451,4 @@ public class JexlArithmetic {
public final Object matches(Object lhs, Object rhs) {
return contains(rhs, lhs);
}
-
}
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlBuilder.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlBuilder.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlBuilder.java Tue Dec 8 15:34:27 2015
@@ -14,8 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.commons.jexl3;
+package org.apache.commons.jexl3;
import org.apache.commons.jexl3.internal.Engine;
import org.apache.commons.jexl3.introspection.JexlSandbox;
@@ -27,11 +27,12 @@ import java.nio.charset.Charset;
/**
* Configure and builds a JexlEngine.
+ *
* <p>The <code>setSilent</code> and <code>setStrict</code> methods allow to fine-tune an engine instance behavior
* according to various error control needs. The strict flag tells the engine when and if null as operand is
* considered an error, the silent flag tells the engine what to do with the error
- * (log as warning or throw exception).
- * </p>
+ * (log as warning or throw exception).</p>
+ *
* <ul>
* <li>When "silent" & "not-strict":
* <p> 0 & null should be indicators of "default" values so that even in an case of error,
@@ -56,66 +57,55 @@ import java.nio.charset.Charset;
* </ul>
*/
public class JexlBuilder {
- /**
- * The default maximum expression length to hit the expression cache.
- */
+
+ /** The default maximum expression length to hit the expression cache. */
protected static final int CACHE_THRESHOLD = 64;
- /**
- * The JexlUberspect instance.
- */
+
+ /** The JexlUberspect instance. */
protected JexlUberspect uberspect = null;
- /**
- * The strategy strategy.
- */
+
+ /** The strategy strategy. */
protected JexlUberspect.ResolverStrategy strategy = null;
- /**
- * The sandbox.
- */
+
+ /** The sandbox. */
protected JexlSandbox sandbox = null;
- /**
- * The Log to which all JexlEngine messages will be logged.
- */
+
+ /** The Log to which all JexlEngine messages will be logged. */
protected Log logger = null;
+
/**
* Whether expressions evaluated by this engine will throw exceptions (false) or
* return null (true) on errors. Default is false.
*/
protected Boolean silent = null;
- /**
- * Whether this engine is in lenient or strict mode; if unspecified, use the arithmetic lenient property.
- */
+
+ /** Whether this engine is in lenient or strict mode; if unspecified, use the arithmetic lenient property. */
protected Boolean strict = null;
- /**
- * Whether error messages will carry debugging information.
- */
+
+ /** Whether error messages will carry debugging information. */
protected Boolean debug = null;
- /**
- * The map of 'prefix:function' to object implementing the namespaces.
- */
+
+ /** The map of 'prefix:function' to object implementing the namespaces. */
protected Map<String, Object> namespaces = null;
- /**
- * The {@link JexlArithmetic} instance.
- */
+
+ /** The {@link JexlArithmetic} instance. */
protected JexlArithmetic arithmetic = null;
- /**
- * The cache size.
- */
+
+ /** The cache size. */
protected int cache = -1;
- /**
- * The maximum expression length to hit the expression cache.
- */
+
+ /** The maximum expression length to hit the expression cache. */
protected int cacheThreshold = CACHE_THRESHOLD;
- /**
- * The charset.
- */
+
+ /** The charset. */
protected Charset charset = Charset.defaultCharset();
- /**
- * The class loader.
- */
+
+ /** The class loader. */
protected ClassLoader loader = null;
/**
* Sets the JexlUberspect instance the engine will use.
+ *
* @param u the uberspect
* @return this builder
*/
@@ -132,6 +122,7 @@ public class JexlBuilder {
/**
* Sets the JexlUberspect strategy strategy the engine will use.
* <p>This is ignored if the uberspect has been set.
+ *
* @param rs the strategy
* @return this builder
*/
@@ -147,6 +138,7 @@ public class JexlBuilder {
/**
* Sets the JexlArithmetic instance the engine will use.
+ *
* @param a the arithmetic
* @return this builder
*/
@@ -162,6 +154,7 @@ public class JexlBuilder {
/**
* Sets the sandbox the engine will use.
+ *
* @param box the sandbox
* @return this builder
*/
@@ -177,6 +170,7 @@ public class JexlBuilder {
/**
* Sets the o.a.c.Log instance to use.
+ *
* @param l the logger
* @return this builder
*/
@@ -192,6 +186,7 @@ public class JexlBuilder {
/**
* Sets the class loader to use.
+ *
* @param l the class loader
* @return this builder
*/
@@ -207,6 +202,7 @@ public class JexlBuilder {
/**
* Sets the charset to use.
+ *
* @param arg the charset
* @return this builder
*/
@@ -222,6 +218,7 @@ public class JexlBuilder {
/**
* Sets whether the engine will throw JexlException during evaluation when an error is triggered.
+ *
* @param flag true means no JexlException will occur, false allows them
* @return this builder
*/
@@ -238,6 +235,7 @@ public class JexlBuilder {
/**
* Sets whether the engine considers unknown variables, methods, functions and constructors as errors or
* evaluates them as null.
+ *
* @param flag true means strict error reporting, false allows them to be evaluated as null
* @return this builder
*/
@@ -253,6 +251,7 @@ public class JexlBuilder {
/**
* Sets whether the engine will report debugging information when error occurs.
+ *
* @param flag true implies debug is on, false implies debug is off.
* @return this builder
*/
@@ -287,6 +286,7 @@ public class JexlBuilder {
* </p>
* <p>Note that the JexlContext is also used to try to solve top-level namespaces. This allows ObjectContext
* derived instances to call methods on the wrapped object.</p>
+ *
* @param ns the map of namespaces
* @return this builder
*/
@@ -306,6 +306,7 @@ public class JexlBuilder {
* Sets the expression cache size the engine will use.
* <p>The cache will contain at most <code>size</code> expressions of at most <code>cacheThreshold</code> length.
* Note that all JEXL caches are held through SoftReferences and may be garbage-collected.</p>
+ *
* @param size if not strictly positive, no cache is used.
* @return this builder
*/
@@ -314,7 +315,9 @@ public class JexlBuilder {
return this;
}
- /**@return the cache size */
+ /**
+ * @return the cache size
+ */
public int cache() {
return cache;
}
@@ -325,6 +328,7 @@ public class JexlBuilder {
* bypass the cache.</p>
* <p>It is expected that a "long" script will be parsed once and its reference kept
* around in user-space structures; the jexl expression cache has no added-value in this case.</p>
+ *
* @param length if not strictly positive, the value is silently replaced by the default value (64).
* @return this builder
*/
@@ -333,7 +337,9 @@ public class JexlBuilder {
return this;
}
- /**@return the cache threshold */
+ /**
+ * @return the cache threshold
+ */
public int cacheThreshold() {
return cacheThreshold;
}
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlContext.java Tue Dec 8 15:34:27 2015
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jexl3;
/**
@@ -34,8 +35,10 @@ package org.apache.commons.jexl3;
* @since 1.0
*/
public interface JexlContext {
+
/**
* Gets the value of a variable.
+ *
* @param name the variable's name
* @return the value
*/
@@ -43,6 +46,7 @@ public interface JexlContext {
/**
* Sets the value of a variable.
+ *
* @param name the variable's name
* @param value the variable's value
*/
@@ -50,29 +54,31 @@ public interface JexlContext {
/**
* Checks whether a variable is defined in this context.
+ *
* <p>A variable may be defined with a null value; this method checks whether the
* value is null or if the variable is undefined.</p>
+ *
* @param name the variable's name
* @return true if it exists, false otherwise
*/
boolean has(String name);
/**
- *
* This interface declares how to resolve a namespace from its name; it is used by the interpreter during
* evalutation.
- * <p>
- * In JEXL, a namespace is an object that serves the purpose of encapsulating functions; for instance,
- * the "math" namespace would be the proper object to expose functions like "log(...)", "sinus(...)", etc.
- * </p>
+ *
+ * <p>In JEXL, a namespace is an object that serves the purpose of encapsulating functions; for instance,
+ * the "math" namespace would be the proper object to expose functions like "log(...)", "sinus(...)", etc.</p>
+ *
* In expressions like "ns:function(...)", the resolver is called with resolveNamespace("ns").
- * <p>
- * JEXL itself reserves 'jexl' and 'ujexl' as namespaces for internal purpose; resolving those may lead to
- * unexpected results.
- * </p>
+ *
+ * <p>JEXL itself reserves 'jexl' and 'ujexl' as namespaces for internal purpose; resolving those may lead to
+ * unexpected results.</p>
+ *
* @since 3.0
*/
public interface NamespaceResolver {
+
/**
* Resolves a namespace by its name.
* @param name the name
@@ -83,6 +89,7 @@ public interface JexlContext {
/**
* Namespace type that allows creating an instance to delegate namespace methods calls to.
+ *
* <p>The functor is created once during the lifetime of a script evaluation.</p>
*/
public interface NamespaceFunctor {
@@ -102,6 +109,7 @@ public interface JexlContext {
* keeping a reference to such a context is to be considered with great care and caution.
* It should also be noted that sharing such a context between threads should implicate synchronizing variable
* accessing the implementation class.
+ *
* @see JexlEngine#setThreadContext(JexlContext.ThreadLocal)
* @see JexlEngine#getThreadContext()
*/
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlEngine.java Tue Dec 8 15:34:27 2015
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jexl3;
import org.apache.commons.jexl3.introspection.JexlUberspect;
@@ -36,14 +37,15 @@ import java.nio.charset.Charset;
* <li>Error reporting</li>
* <li>Logging</li>
* </ul>
- * <p>
- * Note that methods that evaluate expressions may throw <em>unchecked</em> exceptions;
+ *
+ * <p>Note that methods that evaluate expressions may throw <em>unchecked</em> exceptions;
* The {@link JexlException} are thrown in "non-silent" mode but since these are
- * RuntimeException, user-code <em>should</em> catch them wherever most appropriate.
- * </p>
+ * RuntimeException, user-code <em>should</em> catch them wherever most appropriate.</p>
+ *
* @since 2.0
*/
public abstract class JexlEngine {
+
/** A marker for invocation failures in tryInvoke. */
public static final Object TRY_FAILED = new Object() {
@Override
@@ -65,6 +67,7 @@ public abstract class JexlEngine {
/**
* Accesses the current thread local context.
+ *
* @return the context or null
*/
public static JexlContext.ThreadLocal getThreadContext() {
@@ -75,6 +78,7 @@ public abstract class JexlEngine {
* Sets the current thread local context.
* <p>This should only be used carefully, for instance when re-evaluating a "stored" script that requires a
* given Namespace resolver. Remember to synchronize access if context is shared between threads.
+ *
* @param tls the thread local context to set
*/
public static void setThreadContext(JexlContext.ThreadLocal tls) {
@@ -86,13 +90,16 @@ public abstract class JexlEngine {
* <p>The JexlContext used for evaluation can implement this interface to alter behavior.</p>
*/
public interface Options {
+
/**
* The charset used for parsing.
+ *
* @return the charset
*/
Charset getCharset();
/**
* Sets whether the engine will throw a {@link JexlException} when an error is encountered during evaluation.
+ *
* @return true if silent, false otherwise
*/
Boolean isSilent();
@@ -100,24 +107,28 @@ public abstract class JexlEngine {
/**
* Checks whether the engine considers unknown variables, methods, functions and constructors as errors or
* evaluates them as null.
+ *
* @return true if strict, false otherwise
*/
Boolean isStrict();
/**
* Checks whether the arithmetic triggers errors during evaluation when null is used as an operand.
+ *
* @return true if strict, false otherwise
*/
Boolean isStrictArithmetic();
/**
* The MathContext instance used for +,-,/,*,% operations on big decimals.
+ *
* @return the math context
*/
MathContext getArithmeticMathContext();
/**
* The BigDecimal scale used for comparison and coercion operations.
+ *
* @return the scale
*/
int getArithmeticMathScale();
@@ -158,36 +169,42 @@ public abstract class JexlEngine {
/**
* Gets the charset used for parsing.
+ *
* @return the charset
*/
public abstract Charset getCharset();
/**
* Gets this engine underlying {@link JexlUberspect}.
+ *
* @return the uberspect
*/
public abstract JexlUberspect getUberspect();
/**
* Gets this engine underlying {@link JexlArithmetic}.
+ *
* @return the arithmetic
*/
public abstract JexlArithmetic getArithmetic();
/**
* Checks whether this engine is in debug mode.
+ *
* @return true if debug is on, false otherwise
*/
public abstract boolean isDebug();
/**
* Checks whether this engine throws JexlException during evaluation.
+ *
* @return true if silent, false (default) otherwise
*/
public abstract boolean isSilent();
/**
* Checks whether the engine considers unknown variables, methods, functions and constructors as errors.
+ *
* @return true if strict, false otherwise
*/
public abstract boolean isStrict();
@@ -196,12 +213,14 @@ public abstract class JexlEngine {
* Sets the class loader used to discover classes in 'new' expressions.
* <p>This method is <em>not</em> thread safe; it should be called as an optional step of the JexlEngine
* initialization code before expression creation & evaluation.</p>
+ *
* @param loader the class loader to use
*/
public abstract void setClassLoader(ClassLoader loader);
/**
* Creates a new {@link JxltEngine} instance using this engine.
+ *
* @return a JEXL Template engine
*/
public JxltEngine createJxltEngine() {
@@ -210,6 +229,7 @@ public abstract class JexlEngine {
/**
* Creates a new {@link JxltEngine} instance using this engine.
+ *
* @param noScript whether the JxltEngine only allows Jexl expressions or scripts
* @return a JEXL Template engine
*/
@@ -219,6 +239,7 @@ public abstract class JexlEngine {
/**
* Creates a new instance of {@link JxltEngine} using this engine.
+ *
* @param noScript whether the JxltEngine only allows JEXL expressions or scripts
* @param cacheSize the number of expressions in this cache, default is 256
* @param immediate the immediate template expression character, default is '$'
@@ -438,6 +459,7 @@ public abstract class JexlEngine {
/**
* Invokes an object's method by name and arguments.
+ *
* @param obj the method's invoker object
* @param meth the method's name
* @param args the method's arguments
@@ -448,6 +470,7 @@ public abstract class JexlEngine {
/**
* Creates a new instance of an object using the most appropriate constructor based on the arguments.
+ *
* @param <T> the type of object
* @param clazz the class to instantiate
* @param args the constructor arguments
@@ -457,6 +480,7 @@ public abstract class JexlEngine {
/**
* Creates a new instance of an object using the most appropriate constructor based on the arguments.
+ *
* @param clazz the name of the class to instantiate resolved through this engine's class loader
* @param args the constructor arguments
* @return the created object instance or null on failure when silent
@@ -465,6 +489,7 @@ public abstract class JexlEngine {
/**
* Creates a JexlInfo instance.
+ *
* @param fn url/file/template/script user given name
* @param l line number
* @param c column number
@@ -478,6 +503,7 @@ public abstract class JexlEngine {
* Create an information structure for dynamic set/get/invoke/new.
* <p>This gathers the class, method and line number of the first calling method
* outside of o.a.c.jexl3.</p>
+ *
* @return a JexlInfo instance
*/
public JexlInfo createInfo() {
@@ -508,6 +534,7 @@ public abstract class JexlEngine {
/**
* Creates a string from a reader.
+ *
* @param reader to be read.
* @return the contents of the reader as a String.
* @throws IOException on any error reading the reader.
@@ -523,6 +550,7 @@ public abstract class JexlEngine {
/**
* Reads a JEXL source from a File.
+ *
* @param file the script file
* @return the source
*/
@@ -549,6 +577,7 @@ public abstract class JexlEngine {
/**
* Reads a JEXL source from an URL.
+ *
* @param url the script url
* @return the source
*/
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlException.java Tue Dec 8 15:34:27 2015
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jexl3;
import org.apache.commons.jexl3.internal.Debugger;
@@ -30,18 +31,23 @@ import java.util.List;
/**
* Wraps any error that might occur during interpretation of a script or expression.
+ *
* @since 2.0
*/
public class JexlException extends RuntimeException {
+
/** The point of origin for this exception. */
private final transient JexlNode mark;
+
/** The debug info. */
private final transient JexlInfo info;
+
/** Maximum number of characters around exception location. */
private static final int MAX_EXCHARLOC = 42;
/**
* Creates a new JexlException.
+ *
* @param node the node causing the error
* @param msg the error message
*/
@@ -51,6 +57,7 @@ public class JexlException extends Runti
/**
* Creates a new JexlException.
+ *
* @param node the node causing the error
* @param msg the error message
* @param cause the exception causing the error
@@ -68,6 +75,7 @@ public class JexlException extends Runti
/**
* Creates a new JexlException.
+ *
* @param jinfo the debugging information associated
* @param msg the error message
* @param cause the exception causing the error
@@ -80,6 +88,7 @@ public class JexlException extends Runti
/**
* Gets the specific information for this exception.
+ *
* @return the information
*/
public JexlInfo getInfo() {
@@ -88,6 +97,7 @@ public class JexlException extends Runti
/**
* Creates a string builder pre-filled with common error information (if possible).
+ *
* @param node the node
* @return a string builder
*/
@@ -105,6 +115,7 @@ public class JexlException extends Runti
/**
* Gets the most specific information attached to a node.
+ *
* @param node the node
* @param info the information
* @return the information or null
@@ -126,6 +137,7 @@ public class JexlException extends Runti
/**
* Cleans a JexlException from any org.apache.commons.jexl3.internal stack trace element.
+ *
* @return this exception
*/
public JexlException clean() {
@@ -134,6 +146,7 @@ public class JexlException extends Runti
/**
* Cleans a Throwable from any org.apache.commons.jexl3.internal stack trace element.
+ *
* @param <X> the throwable type
* @param xthrow the thowable
* @return the throwable
@@ -157,6 +170,7 @@ public class JexlException extends Runti
/**
* Unwraps the cause of a throwable due to reflection.
+ *
* @param xthrow the throwable
* @return the cause
*/
@@ -172,6 +186,7 @@ public class JexlException extends Runti
/**
* Merge the node info and the cause info to obtain best possible location.
+ *
* @param info the node
* @param cause the cause
* @return the info to use
@@ -189,6 +204,7 @@ public class JexlException extends Runti
/**
* Accesses detailed message.
+ *
* @return the message
*/
protected String detailedMessage() {
@@ -197,6 +213,7 @@ public class JexlException extends Runti
/**
* Formats an error message from the parser.
+ *
* @param prefix the prefix to the message
* @param expr the expression in error
* @return the formatted message
@@ -220,6 +237,7 @@ public class JexlException extends Runti
/**
* Thrown when tokenization fails.
+ *
* @since 3.0
*/
public static class Tokenization extends JexlException {
@@ -247,11 +265,13 @@ public class JexlException extends Runti
/**
* Thrown when parsing fails.
+ *
* @since 3.0
*/
public static class Parsing extends JexlException {
/**
* Creates a new Parsing exception instance.
+ *
* @param info the location information
* @param cause the javacc cause
*/
@@ -261,6 +281,7 @@ public class JexlException extends Runti
/**
* Creates a new Parsing exception instance.
+ *
* @param info the location information
* @param msg the message
*/
@@ -283,6 +304,7 @@ public class JexlException extends Runti
/**
* Thrown when parsing fails due to an ambiguous statement.
+ *
* @since 3.0
*/
public static class Ambiguous extends Parsing {
@@ -303,11 +325,13 @@ public class JexlException extends Runti
/**
* Thrown when parsing fails due to an invalid assigment.
+ *
* @since 3.0
*/
public static class Assignment extends Parsing {
/**
* Creates a new Assignment statement exception instance.
+ *
* @param info the location information
* @param expr the source expression line
*/
@@ -323,6 +347,7 @@ public class JexlException extends Runti
/**
* Thrown when a variable is unknown.
+ *
* @since 3.0
*/
public static class Variable extends JexlException {
@@ -332,6 +357,7 @@ public class JexlException extends Runti
private final boolean undefined;
/**
* Creates a new Variable exception instance.
+ *
* @param node the offending ASTnode
* @param var the unknown variable
* @param undef whether the variable is undefined or evaluated as null
@@ -343,6 +369,7 @@ public class JexlException extends Runti
/**
* Whether the variable causing an error is undefined or evaluated as null.
+ *
* @return true if undefined, false otherwise
*/
public boolean isUndefined() {
@@ -364,6 +391,7 @@ public class JexlException extends Runti
/**
* Generates a message for a variable error.
+ *
* @param node the node where the error occurred
* @param variable the variable
* @param undef whether the variable is null or undefined
@@ -383,11 +411,13 @@ public class JexlException extends Runti
/**
* Thrown when a property is unknown.
+ *
* @since 3.0
*/
public static class Property extends JexlException {
/**
* Creates a new Property exception instance.
+ *
* @param node the offending ASTnode
* @param var the unknown variable
*/
@@ -397,6 +427,7 @@ public class JexlException extends Runti
/**
* Creates a new Property exception instance.
+ *
* @param node the offending ASTnode
* @param var the unknown variable
* @param cause the exception causing the error
@@ -420,6 +451,7 @@ public class JexlException extends Runti
/**
* Generates a message for an unsolvable property error.
+ *
* @param node the node where the error occurred
* @param var the variable
* @return the error message
@@ -434,11 +466,13 @@ public class JexlException extends Runti
/**
* Thrown when a method or ctor is unknown, ambiguous or inaccessible.
+ *
* @since 3.0
*/
public static class Method extends JexlException {
/**
* Creates a new Method exception instance.
+ *
* @param node the offending ASTnode
* @param name the method name
*/
@@ -448,6 +482,7 @@ public class JexlException extends Runti
/**
* Creates a new Method exception instance.
+ *
* @param info the location information
* @param name the unknown method
* @param cause the exception causing the error
@@ -471,6 +506,7 @@ public class JexlException extends Runti
/**
* Generates a message for a unsolvable method error.
+ *
* @param node the node where the error occurred
* @param method the method name
* @return the error message
@@ -485,11 +521,13 @@ public class JexlException extends Runti
/**
* Thrown when an operator fails.
+ *
* @since 3.0
*/
public static class Operator extends JexlException {
/**
* Creates a new Operator exception instance.
+ *
* @param node the location information
* @param symbol the operator name
* @param cause the exception causing the error
@@ -513,6 +551,7 @@ public class JexlException extends Runti
/**
* Generates a message for an operator error.
+ *
* @param node the node where the error occurred
* @param symbol the operator name
* @return the error message
@@ -527,14 +566,17 @@ public class JexlException extends Runti
/**
* Thrown to return a value.
+ *
* @since 3.0
*/
public static class Return extends JexlException {
+
/** The returned value. */
private final Object result;
/**
* Creates a new instance of Return.
+ *
* @param node the return node
* @param msg the message
* @param value the returned value
@@ -554,11 +596,13 @@ public class JexlException extends Runti
/**
* Thrown to cancel a script execution.
+ *
* @since 3.0
*/
public static class Cancel extends JexlException {
/**
* Creates a new instance of Cancel.
+ *
* @param node the node where the interruption was detected
*/
public Cancel(JexlNode node) {
@@ -568,11 +612,13 @@ public class JexlException extends Runti
/**
* Thrown to break a loop.
+ *
* @since 3.0
*/
public static class Break extends JexlException {
/**
* Creates a new instance of Break.
+ *
* @param node the break
*/
public Break(JexlNode node) {
@@ -582,11 +628,13 @@ public class JexlException extends Runti
/**
* Thrown to continue a loop.
+ *
* @since 3.0
*/
public static class Continue extends JexlException {
/**
* Creates a new instance of Continue.
+ *
* @param node the continue
*/
public Continue(JexlNode node) {
@@ -597,10 +645,12 @@ public class JexlException extends Runti
/**
* Detailed info message about this error.
* Format is "debug![begin,end]: string \n msg" where:
+ * <ul></ul>
* - debug is the debugging information if it exists (@link JexlEngine.setDebug)
* - begin, end are character offsets in the string for the precise location of the error
* - string is the string representation of the offending expression
* - msg is the actual explanation message for this error
+ *
* @return this error as a string
*/
@Override
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=1718634&r1=1718633&r2=1718634&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 Tue Dec 8 15:34:27 2015
@@ -17,7 +17,6 @@
package org.apache.commons.jexl3;
-
/**
* Represents a single JEXL expression.
* <p>
@@ -34,6 +33,7 @@ package org.apache.commons.jexl3;
* @since 1.0
*/
public interface JexlExpression {
+
/**
* Evaluates the expression with the variables contained in the
* supplied {@link JexlContext}.
@@ -46,12 +46,14 @@ 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.
+ *
* @return the source text
*/
String getParsedText();
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlInfo.java Tue Dec 8 15:34:27 2015
@@ -14,19 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.commons.jexl3;
+package org.apache.commons.jexl3;
/**
* Helper class to carry information such as a url/file name, line and column for
* debugging information reporting.
*/
public class JexlInfo {
- /** line number. */
+
+ /** line number */
protected final int line;
- /** column number. */
+
+ /** column number */
protected final int column;
- /** name. */
+
+ /** name */
protected final String name;
/**
@@ -44,19 +47,23 @@ public class JexlInfo {
* @return the start column on the line that triggered the error
*/
int start();
+
/**
* @return the end column on the line that triggered the error
*/
int end();
+
/**
* @return the actual part of code that triggered the error
*/
+
@Override
String toString();
}
/**
* Create info.
+ *
* @param source source name
* @param l line number
* @param c column number
@@ -69,6 +76,7 @@ public class JexlInfo {
/**
* Creates info reusing the name.
+ *
* @param l the line
* @param c the column
* @return a new info instance
@@ -79,6 +87,7 @@ public class JexlInfo {
/**
* The copy constructor.
+ *
* @param copy the instance to copy
*/
protected JexlInfo(JexlInfo copy) {
@@ -118,6 +127,7 @@ public class JexlInfo {
/**
* Gets the file/script/url name.
+ *
* @return template name
*/
public final String getName() {
@@ -126,6 +136,7 @@ public class JexlInfo {
/**
* Gets the line number.
+ *
* @return line number.
*/
public final int getLine() {
@@ -134,6 +145,7 @@ public class JexlInfo {
/**
* Gets the column number.
+ *
* @return the column.
*/
public final int getColumn() {
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlOperator.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlOperator.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlOperator.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlOperator.java Tue Dec 8 15:34:27 2015
@@ -14,226 +14,264 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jexl3;
/**
* The JEXL operators.
*
* These are the operators that are executed by JexlArithmetic methods.
- * <p>
- * Each of them associates a symbol to a method signature.
- * For instance, '+' is associated to 'T add(L x, R y)'.
- * </p>
- * <p>
- * The default JexlArithmetic implements generic versions of these methods using Object as arguments.
+ *
+ * <p>Each of them associates a symbol to a method signature.
+ * For instance, '+' is associated to 'T add(L x, R y)'.</p>
+ *
+ * <p>The default JexlArithmetic implements generic versions of these methods using Object as arguments.
* You can use your own derived JexlArithmetic that override and/or overload those operator methods; these methods
* must be public,
* must respect the return type when primitive
- * and may be overloaded multiple times with different signatures.
- * </p>
+ * and may be overloaded multiple times with different signatures.</p>
+ *
* @since 3.0
*/
public enum JexlOperator {
+
/**
* <strong>Syntax:</strong> <code>x + y</code>
* <br><strong>Method:</strong> <code>T add(L x, R y);</code>.
* @see JexlArithmetic#add
*/
ADD("+", "add", 2),
+
/**
* <strong>Syntax:</strong> <code>x - y</code>
* <br><strong>Method:</strong> <code>T subtract(L x, R y);</code>.
* @see JexlArithmetic#subtract
*/
SUBTRACT("-", "subtract", 2),
+
/**
* <strong>Syntax:</strong> <code>x * y</code>
* <br><strong>Method:</strong> <code>T multiply(L x, R y);</code>.
* @see JexlArithmetic#multiply
*/
MULTIPLY("*", "multiply", 2),
+
/**
* <strong>Syntax:</strong> <code>x / y</code>
* <br><strong>Method:</strong> <code>T divide(L x, R y);</code>.
* @see JexlArithmetic#divide
*/
DIVIDE("/", "divide", 2),
+
/**
* <strong>Syntax:</strong> <code>x % y</code>
* <br><strong>Method:</strong> <code>T mod(L x, R y);</code>.
* @see JexlArithmetic#mod
*/
MOD("%", "mod", 2),
+
/**
* <strong>Syntax:</strong> <code>x & y</code>
* <br><strong>Method:</strong> <code>T and(L x, R y);</code>.
* @see JexlArithmetic#and
*/
AND("&", "and", 2),
+
/**
* <strong>Syntax:</strong> <code>x | y</code>
* <br><strong>Method:</strong> <code>T or(L x, R y);</code>.
* @see JexlArithmetic#or
*/
OR("|", "or", 2),
+
/**
* <strong>Syntax:</strong> <code>x ^ y</code>
* <br><strong>Method:</strong> <code>T xor(L x, R y);</code>.
* @see JexlArithmetic#xor
*/
XOR("^", "xor", 2),
+
/**
* <strong>Syntax:</strong> <code>x == y</code>
* <br><strong>Method:</strong> <code>boolean equals(L x, R y);</code>.
* @see JexlArithmetic#equals
*/
EQ("==", "equals", 2),
+
/**
* <strong>Syntax:</strong> <code>x < y</code>
* <br><strong>Method:</strong> <code>boolean lessThan(L x, R y);</code>.
* @see JexlArithmetic#lessThan
*/
LT("<", "lessThan", 2),
+
/**
* <strong>Syntax:</strong> <code>x <= y</code>
* <br><strong>Method:</strong> <code>boolean lessThanOrEqual(L x, R y);</code>.
* @see JexlArithmetic#lessThanOrEqual
*/
LTE("<=", "lessThanOrEqual", 2),
+
/**
* <strong>Syntax:</strong> <code>x > y</code>
* <br><strong>Method:</strong> <code>boolean greaterThan(L x, R y);</code>.
* @see JexlArithmetic#greaterThan
*/
GT(">", "greaterThan", 2),
+
/**
* <strong>Syntax:</strong> <code>x >= y</code>
* <br><strong>Method:</strong> <code>boolean greaterThanOrEqual(L x, R y);</code>.
* @see JexlArithmetic#greaterThanOrEqual
*/
GTE(">=", "greaterThanOrEqual", 2),
+
/**
* <strong>Syntax:</strong> <code>x =~ y</code>
* <br><strong>Method:</strong> <code>boolean contains(L x, R y);</code>.
* @see JexlArithmetic#contains
*/
CONTAINS("=~", "contains", 2),
+
/**
* <strong>Syntax:</strong> <code>x =^ y</code>
* <br><strong>Method:</strong> <code>boolean startsWith(L x, R y);</code>.
* @see JexlArithmetic#startsWith
*/
STARTSWITH("=^", "startsWith", 2),
+
/**
* <strong>Syntax:</strong> <code>x =$ y</code>
* <br><strong>Method:</strong> <code>boolean endsWith(L x, R y);</code>.
* @see JexlArithmetic#endsWith
*/
ENDSWITH("=$", "endsWith", 2),
+
/**
* <strong>Syntax:</strong> <code>!x</code>
* <br><strong>Method:</strong> <code>T not(L x);</code>.
* @see JexlArithmetic#not
*/
NOT("!", "not", 1),
+
/**
* <strong>Syntax:</strong> <code>~x</code>
* <br><strong>Method:</strong> <code>T complement(L x);</code>.
* @see JexlArithmetic#complement
*/
COMPLEMENT("~", "complement", 1),
+
/**
* <strong>Syntax:</strong> <code>-x</code>
* <br><strong>Method:</strong> <code>T negate(L x);</code>.
* @see JexlArithmetic#negate
*/
NEGATE("-", "negate", 1),
+
/**
* <strong>Syntax:</strong> <code>empty x</code> or <code>empty(x)</code>
* <br><strong>Method:</strong> <code>boolean isEmpty(L x);</code>.
* @see JexlArithmetic#isEmpty
*/
EMPTY("empty", "empty", 1),
+
/**
* <strong>Syntax:</strong> <code>size x</code> or <code>size(x)</code>
* <br><strong>Method:</strong> <code>int size(L x);</code>.
* @see JexlArithmetic#size
*/
SIZE("size", "size", 1),
+
/**
* <strong>Syntax:</strong> <code>x += y</code>
* <br><strong>Method:</strong> <code>T selfAdd(L x, R y);</code>.
*/
SELF_ADD("+=", "selfAdd", ADD),
+
/**
* <strong>Syntax:</strong> <code>x -= y</code>
* <br><strong>Method:</strong> <code>T selfSubtract(L x, R y);</code>.
*/
SELF_SUBTRACT("-=", "selfSubtract", SUBTRACT),
+
/**
* <strong>Syntax:</strong> <code>x *= y</code>
* <br><strong>Method:</strong> <code>T selfMultiply(L x, R y);</code>.
*/
SELF_MULTIPLY("*=", "selfMultiply", MULTIPLY),
+
/**
* <strong>Syntax:</strong> <code>x /= y</code>
* <br><strong>Method:</strong> <code>T selfDivide(L x, R y);</code>.
*/
SELF_DIVIDE("/=", "selfDivide", DIVIDE),
+
/**
* <strong>Syntax:</strong> <code>x %= y</code>
* <br><strong>Method:</strong> <code>T selfMod(L x, R y);</code>.
*/
SELF_MOD("%=", "selfMod", MOD),
+
/**
* <strong>Syntax:</strong> <code>x &= y</code>
* <br><strong>Method:</strong> <code>T selfAnd(L x, R y);</code>.
*/
SELF_AND("&=", "selfAnd", AND),
+
/**
* <strong>Syntax:</strong> <code>x |= y</code>
* <br><strong>Method:</strong> <code>T selfOr(L x, R y);</code>.
*/
SELF_OR("|=", "selfOr", OR),
+
/**
* <strong>Syntax:</strong> <code>x ^= y</code>
* <br><strong>Method:</strong> <code>T selfXor(L x, R y);</code>.
*/
SELF_XOR("^=", "selfXor", XOR),
+
/**
* Marker for side effect.
* <br>Returns this from 'self*' overload method to let the engine know the side effect has been performed and
* there is no need to assign the result.
*/
ASSIGN("=", null, null),
+
/**
* Property get operator as in: x.y.
*/
PROPERTY_GET(".", "propertyGet", 2),
+
/**
* Property set operator as in: x.y = z.
*/
PROPERTY_SET(".=", "propertySet", 3),
+
/**
* Array get operator as in: x[y].
*/
ARRAY_GET("[]", "arrayGet", 2),
+
/**
* Array set operator as in: x[y] = z.
*/
ARRAY_SET("[]=", "arraySet", 3);
+
/**
* The operator symbol.
*/
private final String operator;
+
/**
* The associated operator method name.
*/
private final String methodName;
+
/**
* The method arity (ie number of arguments).
*/
private final int arity;
+
/**
* The base operator.
*/
@@ -241,6 +279,7 @@ public enum JexlOperator {
/**
* Creates a base operator.
+ *
* @param o the operator name
* @param m the method name associated to this operator in a JexlArithmetic
* @param argc the number of parameters for the method
@@ -254,6 +293,7 @@ public enum JexlOperator {
/**
* Creates a side-effect operator.
+ *
* @param o the operator name
* @param m the method name associated to this operator in a JexlArithmetic
* @param b the base operator, ie + for +=
@@ -267,6 +307,7 @@ public enum JexlOperator {
/**
* Gets this operator symbol.
+ *
* @return the symbol
*/
public final String getOperatorSymbol() {
@@ -275,6 +316,7 @@ public enum JexlOperator {
/**
* Gets this operator method name in a JexlArithmetic.
+ *
* @return the method name
*/
public final String getMethodName() {
@@ -283,6 +325,7 @@ public enum JexlOperator {
/**
* Gets this operator number of parameters.
+ *
* @return the method arity
*/
public int getArity() {
@@ -291,6 +334,7 @@ public enum JexlOperator {
/**
* Gets the base operator.
+ *
* @return the base operator
*/
public final JexlOperator getBaseOperator() {
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JexlScript.java Tue Dec 8 15:34:27 2015
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jexl3;
import java.util.List;
@@ -22,9 +23,12 @@ import java.util.Set;
import java.util.concurrent.Callable;
/**
- * <p>A JEXL Script.</p>
+ * A JEXL Script.
+ *
* <p>A script is some valid JEXL syntax to be executed with a given set of {@link JexlContext} variables.</p>
+ *
* <p>A script is a group of statements, separated by semicolons.</p>
+ *
* <p>The statements can be <code>blocks</code> (curly braces containing code),
* Control statements such as <code>if</code> and <code>while</code>
* as well as expressions and assignment statements.</p>
@@ -32,20 +36,24 @@ import java.util.concurrent.Callable;
* @since 1.1
*/
public interface JexlScript {
+
/**
* Returns the source text of this expression.
+ *
* @return the source text
*/
String getSourceText();
/**
* Recreates the source text of this expression from the internal syntactic tree.
+ *
* @return the source text
*/
String getParsedText();
/**
* Recreates the source text of this expression from the internal syntactic tree.
+ *
* @param indent the number of spaces for indentation, 0 meaning no indentation
* @return the source text
*/
@@ -57,7 +65,7 @@ public interface JexlScript {
*
* @param context A JexlContext containing variables.
* @return The result of this script, usually the result of
- * the last statement.
+ * the last statement.
*/
Object execute(JexlContext context);
@@ -69,13 +77,14 @@ public interface JexlScript {
* @param context A JexlContext containing variables.
* @param args the arguments
* @return The result of this script, usually the result of
- * the last statement.
+ * the last statement.
* @since 2.1
*/
Object execute(JexlContext context, Object... args);
/**
* Gets this script parameters.
+ *
* @return the parameters or null
* @since 2.1
*/
@@ -83,6 +92,7 @@ public interface JexlScript {
/**
* Gets this script local variables.
+ *
* @return the local variables or null
* @since 2.1
*/
@@ -92,6 +102,7 @@ public interface JexlScript {
* Gets this script variables.
* <p>Note that since variables can be in an ant-ish form (ie foo.bar.quux), each variable is returned as
* a list of strings where each entry is a fragment of the variable ({"foo", "bar", "quux"} in the example.</p>
+ *
* @return the variables or null
* @since 2.1
*/
@@ -99,14 +110,17 @@ public interface JexlScript {
/**
* Gets this script pragmas.
+ *
* @return the (non null, may be empty) pragmas map
*/
Map<String, Object> getPragmas();
/**
* Creates a Callable from this script.
+ *
* <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 2.1
@@ -115,8 +129,10 @@ public interface JexlScript {
/**
* Creates a Callable from this script.
+ *
* <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
* @param args the script arguments
* @return the callable
@@ -126,8 +142,10 @@ public interface JexlScript {
/**
* Curries this script, returning a script with bound arguments.
+ *
* <p>If this script does not declare parameters or if all of them are already bound,
* no error is generated and this script is returned.</p>
+ *
* @param args the arguments to bind
* @return the curried script or this script if no binding can occur
*/
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JxltEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JxltEngine.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JxltEngine.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/JxltEngine.java Tue Dec 8 15:34:27 2015
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jexl3;
import java.io.Reader;
@@ -24,30 +25,31 @@ import java.util.Set;
/**
* A simple "JeXL Template" engine.
- * <p>
- * At the base is an evaluator similar to the Unified EL evaluator used in JSP/JSF based on JEXL.
+ *
+ * <p>At the base is an evaluator similar to the Unified EL evaluator used in JSP/JSF based on JEXL.
* At the top is a template engine inspired by Velocity that uses JEXL (instead of OGNL/VTL) as the scripting
- * language.
- * </p>
- * <p>
- * The evaluator is intended to be used in configuration modules, XML based frameworks or JSP taglibs
- * and facilitate the implementation of expression evaluation.
- * </p>
- * <p>
- * The template engine is intended to output any form of text; html, XML, CSV...
- * </p>
+ * language.</p>
+ *
+ * <p>The evaluator is intended to be used in configuration modules, XML based frameworks or JSP taglibs
+ * and facilitate the implementation of expression evaluation.</p>
+ *
+ * <p>The template engine is intended to output any form of text; html, XML, CSV...</p>
+ *
* @since 3.0
*/
public abstract class JxltEngine {
+
/**
* The sole type of (runtime) exception the JxltEngine can throw.
*/
public static class Exception extends JexlException {
+
/** Serial version UID. */
private static final long serialVersionUID = 201112030113L;
/**
* Creates an Exception.
+ *
* @param info the contextual information
* @param msg the exception message
* @param cause the exception cause
@@ -60,17 +62,18 @@ public abstract class JxltEngine {
/**
* A unified expression that can mix immediate, deferred and nested sub-expressions as well as string constants;
* <ul>
- * <li>The "immediate" syntax is of the form <code>"...${jexl-expr}..."</code></li>
- * <li>The "deferred" syntax is of the form <code>"...#{jexl-expr}..."</code></li>
- * <li>The "nested" syntax is of the form <code>"...#{...${jexl-expr0}...}..."</code></li>
- * <li>The "composite" syntax is of the form <code>"...${jexl-expr0}... #{jexl-expr1}..."</code></li>
+ * <li>The "immediate" syntax is of the form <code>"...${jexl-expr}..."</code></li>
+ * <li>The "deferred" syntax is of the form <code>"...#{jexl-expr}..."</code></li>
+ * <li>The "nested" syntax is of the form <code>"...#{...${jexl-expr0}...}..."</code></li>
+ * <li>The "composite" syntax is of the form <code>"...${jexl-expr0}... #{jexl-expr1}..."</code></li>
* </ul>
*
* <p>Deferred and immediate expression carry different intentions:</p>
+ *
* <ul>
- * <li>An immediate expression indicate that evaluation is intended to be performed close to
- * the definition/parsing point.</li>
- * <li>A deferred expression indicate that evaluation is intended to occur at a later stage.</li>
+ * <li>An immediate expression indicate that evaluation is intended to be performed close to
+ * the definition/parsing point.</li>
+ * <li>A deferred expression indicate that evaluation is intended to occur at a later stage.</li>
* </ul>
*
* <p>For instance: <code>"Hello ${name}, now is #{time}"</code> is a composite "deferred" expression since one
@@ -104,14 +107,17 @@ public abstract class JxltEngine {
* @since 2.0
*/
public interface Expression {
+
/**
* Generates this expression's string representation.
+ *
* @return the string representation
*/
String asString();
/**
* Adds this expression's string representation to a StringBuilder.
+ *
* @param strb the builder to fill
* @return the builder argument
*/
@@ -119,9 +125,9 @@ public abstract class JxltEngine {
/**
* Evaluates this expression.
- * <p>
- * If the underlying JEXL engine is silent, errors will be logged through its logger as warning.
- * </p>
+ *
+ * <p>If the underlying JEXL engine is silent, errors will be logged through its logger as warning.</p>
+ *
* @param context the variable context
* @return the result of this expression evaluation or null if an error occurs and the {@link JexlEngine} is
* running in silent mode
@@ -136,6 +142,7 @@ public abstract class JxltEngine {
* If this expression was prepared, this allows to retrieve the
* original expression that lead to it.</p>
* <p>Other expressions return themselves.</p>
+ *
* @return the source expression
*/
Expression getSource();
@@ -144,6 +151,7 @@ public abstract class JxltEngine {
* Gets the list of variables accessed by this expression.
* <p>This method will visit all nodes of the sub-expressions and extract all variables whether they
* are written in 'dot' or 'bracketed' notation. (a.b is equivalent to a['b']).</p>
+ *
* @return the set of variables, each as a list of strings (ant-ish variables use more than 1 string)
* or the empty set if no variables are used
*/
@@ -151,43 +159,43 @@ public abstract class JxltEngine {
/**
* Checks whether this expression is deferred.
+ *
* @return true if deferred, false otherwise
*/
boolean isDeferred();
/**
* Checks whether this expression is immediate.
+ *
* @return true if immediate, false otherwise
*/
boolean isImmediate();
/**
* Evaluates the immediate sub-expressions.
- * <p>
- * When the expression is dependant upon immediate and deferred sub-expressions,
+ *
+ * <p>When the expression is dependant upon immediate and deferred sub-expressions,
* evaluates the immediate sub-expressions with the context passed as parameter
- * and returns this expression deferred form.
- * </p>
- * <p>
- * In effect, this binds the result of the immediate sub-expressions evaluation in the
+ * and returns this expression deferred form.</p>
+ *
+ * <p>In effect, this binds the result of the immediate sub-expressions evaluation in the
* context, allowing to differ evaluation of the remaining (deferred) expression within another context.
* This only has an effect to nested and composite expressions that contain differed and
- * immediate sub-expressions.
- * </p>
- * <p>
- * If the underlying JEXL engine is silent, errors will be logged through its logger as warning.
- * </p>
+ * immediate sub-expressions.</p>
+ *
+ * <p>If the underlying JEXL engine is silent, errors will be logged through its logger as warning.* </p>
+ *
* @param context the context to use for immediate expression evaluations
* @return an {@link Expression} or null if an error occurs and the {@link JexlEngine} is running
* in silent mode
- * @throws Exception if an error occurs and the {@link JexlEngine}
- * is not in silent mode
+ * @throws Exception if an error occurs and the {@link JexlEngine} is not in silent mode
*/
Expression prepare(JexlContext context);
/**
* Formats this expression, adding its source string representation in
* comments if available: 'expression /*= source *\/'' .
+ *
* @return the formatted expression string
*/
@Override
@@ -197,13 +205,12 @@ public abstract class JxltEngine {
/**
* Creates a a {@link Expression} from an expression string.
* Uses and fills up the expression cache if any.
- * <p>
- * If the underlying JEXL engine is silent, errors will be logged through its logger as warnings.
- * </p>
+ *
+ * <p>If the underlying JEXL engine is silent, errors will be logged through its logger as warnings.</p>
+ *
* @param expression the {@link Template} string expression
* @return the {@link Expression}, null if silent and an error occurred
- * @throws Exception if an error occurs and the {@link JexlEngine}
- * is not silent
+ * @throws Exception if an error occurs and the {@link JexlEngine} is not silent
*/
public Expression createExpression(String expression) {
return createExpression(null, expression);
@@ -212,14 +219,13 @@ public abstract class JxltEngine {
/**
* Creates a a {@link Expression} from an expression string.
* Uses and fills up the expression cache if any.
- * <p>
- * If the underlying JEXL engine is silent, errors will be logged through its logger as warnings.
- * </p>
+ *
+ * <p>If the underlying JEXL engine is silent, errors will be logged through its logger as warnings.</p>
+ *
* @param info the {@link JexlInfo} source information
* @param expression the {@link Template} string expression
* @return the {@link Expression}, null if silent and an error occured
- * @throws Exception if an error occurs and the {@link JexlEngine}
- * is not silent
+ * @throws Exception if an error occurs and the {@link JexlEngine} is not silent
*/
public abstract Expression createExpression(JexlInfo info, String expression);
@@ -270,14 +276,17 @@ public abstract class JxltEngine {
* @since 3.0
*/
public interface Template {
+
/**
* Recreate the template source from its inner components.
+ *
* @return the template source rewritten
*/
String asString();
/**
* Evaluates this template.
+ *
* @param context the context to use during evaluation
* @param writer the writer to use for output
*/
@@ -285,6 +294,7 @@ public abstract class JxltEngine {
/**
* Evaluates this template.
+ *
* @param context the context to use during evaluation
* @param writer the writer to use for output
* @param args the arguments
@@ -293,6 +303,7 @@ public abstract class JxltEngine {
/**
* Prepares this template by expanding any contained deferred TemplateExpression.
+ *
* @param context the context to prepare against
* @return the prepared version of the template
*/
@@ -302,6 +313,7 @@ public abstract class JxltEngine {
* Gets the list of variables accessed by this template.
* <p>This method will visit all nodes of the sub-expressions and extract all variables whether they
* are written in 'dot' or 'bracketed' notation. (a.b is equivalent to a['b']).</p>
+ *
* @return the set of variables, each as a list of strings (ant-ish variables use more than 1 string)
* or the empty set if no variables are used
*/
@@ -309,6 +321,7 @@ public abstract class JxltEngine {
/**
* Gets the list of parameters expected by this template.
+ *
* @return the parameter names array
*/
String[] getParameters();
@@ -316,6 +329,7 @@ public abstract class JxltEngine {
/**
* Creates a new template.
+ *
* @param info the jexl info (file, line, column)
* @param prefix the directive prefix
* @param source the source
@@ -326,6 +340,7 @@ public abstract class JxltEngine {
/**
* Creates a new template.
+ *
* @param info the source info
* @param parms the parameter names
* @param source the source
@@ -337,6 +352,7 @@ public abstract class JxltEngine {
/**
* Creates a new template.
+ *
* @param info the source info
* @param source the source
* @return the template
@@ -347,6 +363,7 @@ public abstract class JxltEngine {
/**
* Creates a new template.
+ *
* @param prefix the directive prefix
* @param source the source
* @param parms the parameter names
@@ -358,6 +375,7 @@ public abstract class JxltEngine {
/**
* Creates a new template.
+ *
* @param source the source
* @param parms the parameter names
* @return the template
@@ -368,6 +386,7 @@ public abstract class JxltEngine {
/**
* Creates a new template.
+ *
* @param source the source
* @return the template
*/
@@ -377,6 +396,7 @@ public abstract class JxltEngine {
/**
* Gets the {@link JexlEngine} underlying this template engine.
+ *
* @return the JexlEngine
*/
public abstract JexlEngine getEngine();
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/MapContext.java Tue Dec 8 15:34:27 2015
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jexl3;
import java.util.HashMap;
@@ -24,6 +25,7 @@ import java.util.Map;
* <p>Each entry in the map is considered a variable name, value pair.</p>
*/
public class MapContext implements JexlContext {
+
/**
* The wrapped variable map.
*/
@@ -38,6 +40,7 @@ public class MapContext implements JexlC
/**
* Creates a MapContext wrapping an existing user provided map.
+ *
* @param vars the variable map
*/
public MapContext(Map<String, Object> vars) {
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/ObjectContext.java Tue Dec 8 15:34:27 2015
@@ -14,21 +14,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.jexl3;
/**
* Wraps an Object as a JEXL context and NamespaceResolver.
+ *
* @param <T> the wrapped object type to use
* @since 3.0
*/
public class ObjectContext<T> implements JexlContext, JexlContext.NamespaceResolver {
+
/** The property solving jexl engine. */
protected final JexlEngine jexl;
+
/** The object serving as context provider. */
protected final T object;
/**
* Creates a new ObjectContext.
+ *
* @param engine the jexl engine to use to solve properties
* @param wrapped the object to wrap in this context
*/
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlMethod.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlMethod.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlMethod.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlMethod.java Tue Dec 8 15:34:27 2015
@@ -42,6 +42,7 @@ public interface JexlMethod {
* Attempts to reuse this JexlMethod, checking that it is compatible with
* the actual set of arguments.
* Related to isCacheable since this method is often used with cached JexlMethod instances.
+ *
* @param name the method name
* @param obj the object to invoke the method upon
* @param params the method arguments
@@ -53,6 +54,7 @@ public interface JexlMethod {
/**
* Checks whether a tryInvoke return value indicates a failure or not.
* <p>Usage is : <code>Object r = tryInvoke(...); if (tryFailed(r) {...} else {...}</code>
+ *
* @param rval the value returned by tryInvoke
* @return true if tryInvoke failed, false otherwise
*/
@@ -68,6 +70,7 @@ public interface JexlMethod {
/**
* returns the return type of the method invoked.
+ *
* @return return type
*/
Class<?> getReturnType();
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertyGet.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertyGet.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertyGet.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertyGet.java Tue Dec 8 15:34:27 2015
@@ -23,6 +23,7 @@ package org.apache.commons.jexl3.introsp
* <code>
* ${foo.bar}
* </code>
+ *
* @since 1.0
*/
public interface JexlPropertyGet {
@@ -38,6 +39,7 @@ public interface JexlPropertyGet {
/**
* 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
@@ -47,6 +49,7 @@ public interface JexlPropertyGet {
/**
* Checks whether a tryInvoke failed or not.
+ *
* @param rval the value returned by tryInvoke
* @return true if tryInvoke failed, false otherwise
*/
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertySet.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertySet.java?rev=1718634&r1=1718633&r2=1718634&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertySet.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlPropertySet.java Tue Dec 8 15:34:27 2015
@@ -23,6 +23,7 @@ package org.apache.commons.jexl3.introsp
* <code>
* ${foo.bar = "hello"}
* </code>
+ *
* @since 1.0
*/
public interface JexlPropertySet {
@@ -39,6 +40,7 @@ public interface JexlPropertySet {
/**
* 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
@@ -49,6 +51,7 @@ public interface JexlPropertySet {
/**
* Checks whether a tryInvoke failed or not.
+ *
* @param rval the value returned by tryInvoke
* @return true if tryInvoke failed, false otherwise
*/