Package com.tagtraum.core.app
Class ScriptEngineAdapter
- java.lang.Object
-
- com.tagtraum.core.app.ScriptEngineAdapter
-
public abstract class ScriptEngineAdapter extends Object
This adapter for ScriptEngine allows the instantiation of classes defined in a script file.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ScriptEngineAdapter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Object
createInstance(Path file)
Reads the given file and instantiates the class defined in it.abstract Object
createInstance(ScriptEngine scriptEngine, Path file)
protected Object
evalFile(ScriptEngine scriptEngine, Path file)
static ScriptEngineAdapter
getInstance(ScriptEngineFactory factory)
String
getLanguageName()
URI
getLargeIcon()
protected ScriptEngineFactory
getScriptEngineFactory()
URI
getSmallIcon()
protected void
setIconName(String smallIconName)
-
-
-
Method Detail
-
getLanguageName
public String getLanguageName()
-
getScriptEngineFactory
protected ScriptEngineFactory getScriptEngineFactory()
-
setIconName
protected void setIconName(String smallIconName)
-
evalFile
protected Object evalFile(ScriptEngine scriptEngine, Path file) throws IOException, ScriptException
- Throws:
IOException
ScriptException
-
createInstance
public Object createInstance(Path file) throws IOException, ScriptException, InvocationTargetException, IllegalAccessException, InstantiationException
Reads the given file and instantiates the class defined in it.- Parameters:
file
- script file- Returns:
- instance of the given class
- Throws:
IOException
ScriptException
InvocationTargetException
IllegalAccessException
InstantiationException
-
createInstance
public abstract Object createInstance(ScriptEngine scriptEngine, Path file) throws ScriptException, IOException, InvocationTargetException, IllegalAccessException, InstantiationException
-
getSmallIcon
public URI getSmallIcon()
-
getLargeIcon
public URI getLargeIcon()
-
getInstance
public static ScriptEngineAdapter getInstance(ScriptEngineFactory factory)
-
-