public class ScriptEngineResolver extends Object
Modifier and Type | Field and Description |
---|---|
protected Map<String,ScriptEngine> |
cachedEngines |
protected ScriptEngineManager |
scriptEngineManager |
Constructor and Description |
---|
ScriptEngineResolver(ScriptEngineManager scriptEngineManager) |
Modifier and Type | Method and Description |
---|---|
void |
addScriptEngineFactory(ScriptEngineFactory scriptEngineFactory) |
protected void |
configureGroovyScriptEngine(ScriptEngine scriptEngine)
Allows providing custom configuration for the groovy script engine.
|
ScriptEngine |
getScriptEngine(String language,
boolean resolveFromCache)
Returns a cached script engine or creates a new script engine if no such engine is currently cached.
|
ScriptEngineManager |
getScriptEngineManager() |
protected boolean |
isCachable(ScriptEngine scriptEngine)
Allows checking whether the script engine can be cached.
|
protected final ScriptEngineManager scriptEngineManager
protected Map<String,ScriptEngine> cachedEngines
public ScriptEngineResolver(ScriptEngineManager scriptEngineManager)
public void addScriptEngineFactory(ScriptEngineFactory scriptEngineFactory)
public ScriptEngineManager getScriptEngineManager()
public ScriptEngine getScriptEngine(String language, boolean resolveFromCache)
language
- the language (such as 'groovy' for the script engine)protected boolean isCachable(ScriptEngine scriptEngine)
scriptEngine
- the script engine to check.protected void configureGroovyScriptEngine(ScriptEngine scriptEngine)
scriptEngine
- the groovy script engine to configure.Copyright © 2022. All rights reserved.