org.apache.commons.jexl
public class ScriptFactory extends Object
Creates Scripts. To create a JEXL Script, pass valid JEXL syntax to the static createScript() method:
String jexl = "y = x * 12 + 44; y = y * 4;"; Script script = ScriptFactory.createScript( jexl );
When an Script is created, the JEXL syntax is parsed and verified.
Since: 1.1
Version: $Id: ScriptFactory.java 429175 2006-08-06 19:05:23Z rahul $
Field Summary | |
---|---|
protected static ScriptFactory | factory
ScriptFactory is a singleton and this is the private
instance fufilling that pattern. |
protected static Log | log The Log to which all ScriptFactory messages will be logged. |
protected static Parser | parser
The singleton ScriptFactory also holds a single instance of
Parser. |
Method Summary | |
---|---|
protected Script | createNewScript(String scriptText)
Creates a new Script based on the string.
|
static Script | createScript(String scriptText)
Creates a Script from a String containing valid JEXL syntax.
|
static Script | createScript(File scriptFile)
Creates a Script from a File containing valid JEXL syntax.
|
static Script | createScript(URL scriptUrl)
Creates a Script from a URL containing valid JEXL syntax.
|
protected static ScriptFactory | getInstance()
Returns the single instance of ScriptFactory. |
Parameters: scriptText valid Jexl script
Returns: Script a new script
Throws: Exception for a variety of reasons - mostly malformed scripts
Parameters: scriptText A String containing valid JEXL syntax
Returns: A Script which can be executed with a JexlContext.
Throws: Exception An exception can be thrown if there is a problem parsing the script.
Parameters: scriptFile A File containing valid JEXL syntax. Must not be null. Must be a readable file.
Returns: A Script which can be executed with a JexlContext.
Throws: Exception An exception can be thrown if there is a problem parsing the script.
Parameters: scriptUrl A URL containing valid JEXL syntax. Must not be null. Must be a readable file.
Returns: A Script which can be executed with a JexlContext.
Throws: Exception An exception can be thrown if there is a problem parsing the script.
Returns: the instance of ScriptFactory.