|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.shibboleth.utilities.java.support.scripting.EvaluableScript
public class EvaluableScript
This is a helper class that takes care of reading in, optionally compiling, and evaluating a script.
| Field Summary | |
|---|---|
private CompiledScript |
compiledScript
The compiled form of the script, if the script engine supports compiling. |
private String |
script
The script to execute. |
private ScriptEngine |
scriptEngine
The script engine to execute the script. |
private String |
scriptLanguage
The scripting language. |
| Constructor Summary | |
|---|---|
EvaluableScript(String engineName,
File scriptSource)
Constructor. |
|
EvaluableScript(String engineName,
String scriptSource)
Constructor. |
|
| Method Summary | |
|---|---|
com.google.common.base.Optional<Object> |
eval(Bindings scriptBindings)
Evaluates this script against the given bindings. |
com.google.common.base.Optional<Object> |
eval(ScriptContext scriptContext)
Evaluates this script against the given context. |
String |
getScript()
Gets the script source. |
private void |
initialize()
Initializes the scripting engine and compiles the script, if possible. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final String scriptLanguage
private final String script
private ScriptEngine scriptEngine
private CompiledScript compiledScript
| Constructor Detail |
|---|
public EvaluableScript(@Nonnull@NotEmpty
String engineName,
@Nonnull@NotEmpty
String scriptSource)
throws ScriptException
engineName - the JSR-223 scripting engine namescriptSource - the script source
ScriptException - thrown if the scripting engine supports compilation and the script does not compile
public EvaluableScript(@Nonnull@NotEmpty
String engineName,
@Nonnull
File scriptSource)
throws ScriptException
engineName - the JSR-223 scripting engine namescriptSource - the script source
ScriptException - thrown if the script source file can not be read or the scripting engine supports
compilation and the script does not compile| Method Detail |
|---|
@Nonnull public String getScript()
@Nonnull
public com.google.common.base.Optional<Object> eval(Bindings scriptBindings)
throws ScriptException
scriptBindings - the script bindings
Optional.absent() if the script did not return a result
ScriptException - thrown if there was a problem evaluating the script
@Nonnull
public com.google.common.base.Optional<Object> eval(ScriptContext scriptContext)
throws ScriptException
scriptContext - the script context
Optional.absent() if the script did not return a result
ScriptException - thrown if there was a problem evaluating the script
private void initialize()
throws ScriptException
ScriptException - thrown if the scripting engine supports compilation and the script does not compile
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||