Package org.springframework.scripting.support

# Class StandardScriptUtils

java.lang.Object
org.springframework.scripting.support.StandardScriptUtils

public abstract class StandardScriptUtils extends Object
Common operations for dealing with a JSR-223 `ScriptEngine`.

Since:
  4.2.2
Author:
  Juergen Hoeller

## Constructor Summary

Constructors
Constructor
Description
`StandardScriptUtils()`

## Method Summary

Modifier and Type
Method
Description
`static ScriptEngine`
`retrieveEngineByName(ScriptEngineManager scriptEngineManager, String engineName)`
Retrieve a `ScriptEngine` from the given `ScriptEngineManager` by name, delegating to `ScriptEngineManager.getEngineByName(java.lang.String)` but throwing a descriptive exception if not found or if initialization failed.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### StandardScriptUtils

public StandardScriptUtils()

## Method Details

### retrieveEngineByName

public static ScriptEngine retrieveEngineByName(ScriptEngineManager scriptEngineManager, String engineName)
Retrieve a `ScriptEngine` from the given `ScriptEngineManager` by name, delegating to `ScriptEngineManager.getEngineByName(java.lang.String)` but throwing a descriptive exception if not found or if initialization failed.

Parameters:
  `scriptEngineManager` - the ScriptEngineManager to use
  `engineName` - the name of the engine
Returns:
  a corresponding ScriptEngine (never `null`)
Throws:
  `IllegalArgumentException` - if no matching engine has been found
  `IllegalStateException` - if the desired engine failed to initialize