org.apache.commons.jexl
Class ScriptImpl

java.lang.Object
  extended by org.apache.commons.jexl.ScriptImpl
All Implemented Interfaces:
Script

 class ScriptImpl
extends java.lang.Object
implements Script

Simple script implementation.

Since:
1.1

Field Summary
private  ASTJexlScript parsedScript
          syntax tree.
private  java.lang.String text
          text of the script.
 
Constructor Summary
ScriptImpl(java.lang.String scriptText, ASTJexlScript scriptTree)
          Create a new Script from the given string and parsed syntax.
 
Method Summary
 java.lang.Object execute(JexlContext context)
          Executes the script with the variables contained in the supplied JexlContext.
 java.lang.String getText()
          Returns the text of this Script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

private final java.lang.String text
text of the script.


parsedScript

private final ASTJexlScript parsedScript
syntax tree.

Constructor Detail

ScriptImpl

public ScriptImpl(java.lang.String scriptText,
                  ASTJexlScript scriptTree)
Create a new Script from the given string and parsed syntax.

Parameters:
scriptText - the text of the script.
scriptTree - the parsed script.
Method Detail

execute

public java.lang.Object execute(JexlContext context)
                         throws java.lang.Exception
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.
Throws:
java.lang.Exception - on any script parse or execution error.

getText

public java.lang.String getText()
Returns the text of this Script.

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