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
-
Method Summary
Modifier and TypeMethodDescriptionstatic ScriptEngine
retrieveEngineByName
(ScriptEngineManager scriptEngineManager, String engineName) Retrieve aScriptEngine
from the givenScriptEngineManager
by 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 aScriptEngine
from the givenScriptEngineManager
by 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
-