ExpressionImpl (Commons JEXL 2.0.1 API)
Keywords: org.apache.commons.jexl2.ExpressionImpl class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.jexl2
Class ExpressionImpl

    java.lang.Object
      org.apache.commons.jexl2.ExpressionImpl

All Implemented Interfaces:
  Expression, Script

    public class ExpressionImpl

extends java.lang.Object
implements Expression, Script

Instances of ExpressionImpl are created by the `JexlEngine`, and this is the default implementation of the `Expression` and `Script` interface.

Since:
  1.0
Version:
  $Id: ExpressionImpl.java 885754 2009-12-01 12:47:00Z henrib $
Author:
  Geir Magnusson Jr.

Field Summary
`protected java.lang.String` | `expression` Original expression stripped from leading & trailing spaces.
`protected JexlEngine` | `jexl` The engine for this expression.
`protected ASTJexlScript` | `script` The resulting AST we can interpret.

Constructor Summary
`protected` | `ExpressionImpl(JexlEngine engine, java.lang.String expr, ASTJexlScript ref)` Do not let this be generally instantiated with a 'new'.

Method Summary
`java.lang.String` | `dump()` Returns the JEXL expression by reconstructing it from the parsed tree.
`java.lang.Object` | `evaluate(JexlContext context)` Evaluates the expression with the variables contained in the supplied `JexlContext`.
`java.lang.Object` | `execute(JexlContext context)` Executes the script with the variables contained in the supplied `JexlContext`.
`java.lang.String` | `getExpression()` Returns the JEXL expression this Expression was created with.
`java.lang.String` | `getText()` Returns the text of this Script.
`java.lang.String` | `toString()` Provide a string representation of the expression.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### jexl

    protected final JexlEngine jexl

  The engine for this expression.

### expression

    protected final java.lang.String expression

  Original expression stripped from leading & trailing spaces.

### script

    protected final ASTJexlScript script

  The resulting AST we can interpret.

Constructor Detail

### ExpressionImpl

    protected ExpressionImpl(JexlEngine engine,
                             java.lang.String expr,
                             ASTJexlScript ref)

  Do not let this be generally instantiated with a 'new'.

  Parameters:
    `engine` - the interpreter to evaluate the expression
    `expr` - the expression.
    `ref` - the parsed expression.

Method Detail

### evaluate

    public java.lang.Object evaluate(JexlContext context)

  Evaluates the expression with the variables contained in the supplied `JexlContext`.

  Specified by:
    `evaluate` in interface `Expression`
  Parameters:
    `context` - A JexlContext containing variables.
  Returns:
    The result of this evaluation

### dump

    public java.lang.String dump()

  Returns the JEXL expression by reconstructing it from the parsed tree.

  Specified by:
    `dump` in interface `Expression`
  Returns:
    the JEXL expression

### getExpression

    public java.lang.String getExpression()

  Returns the JEXL expression this Expression was created with.

  Specified by:
    `getExpression` in interface `Expression`
  Returns:
    The JEXL expression to be evaluated

### toString

    public java.lang.String toString()

  Provide a string representation of the expression.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the expression or blank if it's null.

### getText

    public java.lang.String getText()

  Returns the text of this Script.

  Specified by:
    `getText` in interface `Script`
  Returns:
    The script to be executed.

### execute

    public java.lang.Object execute(JexlContext context)

  Executes the script with the variables contained in the supplied `JexlContext`.

  Specified by:
    `execute` in interface `Script`
  Parameters:
    `context` - A JexlContext containing variables.
  Returns:
    The result of this script, usually the result of the last statement.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.