Top Description Constructors Methods
org.springframework.scripting.support

public abstract Class StandardScriptUtils

extends Object
Class Inheritance
Imports
java.util.LinkedHashSet, .List, .Map, .Set, javax.script.Bindings, .ScriptContext, .ScriptEngine, .ScriptEngineFactory, .ScriptEngineManager, .SimpleBindings

Common operations for dealing with a JSR-223 ScriptEngine.
Author
Juergen Hoeller
Since
4.2.2

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static Bindings
public static ScriptEngine

Returns:

a corresponding ScriptEngine (never null)
retrieveEngineByName
(ScriptEngineManager
the ScriptEngineManager to use
scriptEngineManager
,
String
the name of the engine
engineName
)

Retrieve a ScriptEngine from the given ScriptEngineManager by name, delegating to ScriptEngineManager#getEngineByName but throwing a descriptive exception if not found or if initialization failed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StandardScriptUtilsback to summary
public StandardScriptUtils()

Method Detail

getBindingsback to summary
pack-priv static Bindings getBindings(Map<String, Object> bindings)
retrieveEngineByNameback to summary
public static ScriptEngine retrieveEngineByName(ScriptEngineManager scriptEngineManager, String engineName)

Retrieve a ScriptEngine from the given ScriptEngineManager by name, delegating to ScriptEngineManager#getEngineByName but throwing a descriptive exception if not found or if initialization failed.

Parameters
scriptEngineManager:ScriptEngineManager

the ScriptEngineManager to use

engineName:String

the name of the engine

Returns:ScriptEngine

a corresponding ScriptEngine (never null)

Exceptions
IllegalArgumentException:
if no matching engine has been found
IllegalStateException:
if the desired engine failed to initialize