Class StandardScriptUtils
java.lang.Object
org.springframework.scripting.support.StandardScriptUtils
Common operations for dealing with a JSR-223
ScriptEngine.- Since:
- 4.2.2
- Author:
- Juergen Hoeller
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ScriptEngineretrieveEngineByName(ScriptEngineManager scriptEngineManager, String engineName) Retrieve aScriptEnginefrom the givenScriptEngineManagerby name, delegating toScriptEngineManager.getEngineByName(java.lang.String)but throwing a descriptive exception if not found or if initialization failed.
-
Constructor Details
-
StandardScriptUtils
public StandardScriptUtils()
-
-
Method Details
-
retrieveEngineByName
public static ScriptEngine retrieveEngineByName(ScriptEngineManager scriptEngineManager, String engineName) Retrieve aScriptEnginefrom the givenScriptEngineManagerby name, delegating toScriptEngineManager.getEngineByName(java.lang.String)but throwing a descriptive exception if not found or if initialization failed.- Parameters:
scriptEngineManager- the ScriptEngineManager to useengineName- the name of the engine- Returns:
- a corresponding ScriptEngine (never
null) - Throws:
IllegalArgumentException- if no matching engine has been foundIllegalStateException- if the desired engine failed to initialize
-