org.apache.commons.jexl
public class ExpressionFactory extends Object
Creates Expression objects. To create a JEXL Expression object, pass valid JEXL syntax to the static createExpression() method:
String jexl = "array[1]"; Expression expression = ExpressionFactory.createExpression( jexl );
When an Expression object is created, the JEXL syntax is parsed and verified. If the supplied expression is neither an expression nor a reference, an exception is thrown from createException().
Since: 1.0
Version: $Id: ExpressionFactory.java 429169 2006-08-06 18:36:29Z rahul $
Field Summary | |
---|---|
protected static ExpressionFactory | ef
ExpressionFactory is a singleton and this is the private
instance fufilling that pattern. |
protected static Log | log
The Log to which all ExpressionFactory messages will be logged. |
protected static Parser | parser
The singleton ExpressionFactory also holds a single instance of
Parser.
|
Method Summary | |
---|---|
static Expression | createExpression(String expression)
Creates an Expression from a String containing valid
JEXL syntax. |
protected Expression | createNewExpression(String expression)
Creates a new Expression based on the expression string.
|
protected static ExpressionFactory | getInstance()
Returns the single instance of ExpressionFactory. |
Parameters: expression A String containing valid JEXL syntax
Returns: An Expression object which can be evaluated with a JexlContext
Throws: Exception An exception can be thrown if there is a problem parsing this expression, or if the expression is neither an expression or a reference.
Parameters: expression valid Jexl expression
Returns: Expression
Throws: Exception for a variety of reasons - mostly malformed Jexl expression
Returns: the instance of ExpressionFactory.