Module org.openjdk.nashorn
Class NashornScriptEngineFactory
- java.lang.Object
-
- org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory
-
- All Implemented Interfaces:
ScriptEngineFactory
public final class NashornScriptEngineFactory extends Object implements ScriptEngineFactory
JSR-223 compliant script engine factory for Nashorn. The engine answers for:- names
"nashorn"
,"Nashorn"
,"js"
,"JS"
,"JavaScript"
,"javascript"
,"ECMAScript"
, and"ecmascript"
; - MIME types
"application/javascript"
,"application/ecmascript"
,"text/javascript"
, and"text/ecmascript"
; - as well as for the extension
"js"
.
getScriptEngine(String[])
will have the passed arguments accessible as a global variable named"arguments"
.- Since:
- 1.8u40
-
-
Constructor Summary
Constructors Constructor Description NashornScriptEngineFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getEngineName()
String
getEngineVersion()
List<String>
getExtensions()
String
getLanguageName()
String
getLanguageVersion()
String
getMethodCallSyntax(String obj, String method, String... args)
List<String>
getMimeTypes()
List<String>
getNames()
String
getOutputStatement(String toDisplay)
Object
getParameter(String key)
String
getProgram(String... statements)
ScriptEngine
getScriptEngine()
ScriptEngine
getScriptEngine(ClassLoader appLoader)
Create a new Script engine initialized with the given class loader.ScriptEngine
getScriptEngine(String... args)
Create a new Script engine initialized with the given arguments.ScriptEngine
getScriptEngine(String[] args, ClassLoader appLoader)
Create a new Script engine initialized with the given arguments and the given class loader.ScriptEngine
getScriptEngine(String[] args, ClassLoader appLoader, ClassFilter classFilter)
Create a new Script engine initialized with the given arguments, class loader and class filter.ScriptEngine
getScriptEngine(ClassFilter classFilter)
Create a new Script engine initialized with the given class filter.
-
-
-
Method Detail
-
getEngineName
public String getEngineName()
- Specified by:
getEngineName
in interfaceScriptEngineFactory
-
getEngineVersion
public String getEngineVersion()
- Specified by:
getEngineVersion
in interfaceScriptEngineFactory
-
getExtensions
public List<String> getExtensions()
- Specified by:
getExtensions
in interfaceScriptEngineFactory
-
getLanguageName
public String getLanguageName()
- Specified by:
getLanguageName
in interfaceScriptEngineFactory
-
getLanguageVersion
public String getLanguageVersion()
- Specified by:
getLanguageVersion
in interfaceScriptEngineFactory
-
getMethodCallSyntax
public String getMethodCallSyntax(String obj, String method, String... args)
- Specified by:
getMethodCallSyntax
in interfaceScriptEngineFactory
-
getMimeTypes
public List<String> getMimeTypes()
- Specified by:
getMimeTypes
in interfaceScriptEngineFactory
-
getNames
public List<String> getNames()
- Specified by:
getNames
in interfaceScriptEngineFactory
-
getOutputStatement
public String getOutputStatement(String toDisplay)
- Specified by:
getOutputStatement
in interfaceScriptEngineFactory
-
getParameter
public Object getParameter(String key)
- Specified by:
getParameter
in interfaceScriptEngineFactory
-
getProgram
public String getProgram(String... statements)
- Specified by:
getProgram
in interfaceScriptEngineFactory
-
getScriptEngine
public ScriptEngine getScriptEngine()
- Specified by:
getScriptEngine
in interfaceScriptEngineFactory
-
getScriptEngine
public ScriptEngine getScriptEngine(ClassLoader appLoader)
Create a new Script engine initialized with the given class loader.- Parameters:
appLoader
- class loader to be used as script "app" class loader.- Returns:
- newly created script engine.
- Throws:
SecurityException
- if the security manager'scheckPermission
deniesRuntimePermission("nashorn.setConfig")
-
getScriptEngine
public ScriptEngine getScriptEngine(ClassFilter classFilter)
Create a new Script engine initialized with the given class filter.- Parameters:
classFilter
- class filter to use.- Returns:
- newly created script engine.
- Throws:
NullPointerException
- ifclassFilter
isnull
SecurityException
- if the security manager'scheckPermission
deniesRuntimePermission("nashorn.setConfig")
-
getScriptEngine
public ScriptEngine getScriptEngine(String... args)
Create a new Script engine initialized with the given arguments.- Parameters:
args
- arguments array passed to script engine.- Returns:
- newly created script engine.
- Throws:
NullPointerException
- ifargs
isnull
SecurityException
- if the security manager'scheckPermission
deniesRuntimePermission("nashorn.setConfig")
-
getScriptEngine
public ScriptEngine getScriptEngine(String[] args, ClassLoader appLoader)
Create a new Script engine initialized with the given arguments and the given class loader.- Parameters:
args
- arguments array passed to script engine.appLoader
- class loader to be used as script "app" class loader.- Returns:
- newly created script engine.
- Throws:
NullPointerException
- ifargs
isnull
SecurityException
- if the security manager'scheckPermission
deniesRuntimePermission("nashorn.setConfig")
-
getScriptEngine
public ScriptEngine getScriptEngine(String[] args, ClassLoader appLoader, ClassFilter classFilter)
Create a new Script engine initialized with the given arguments, class loader and class filter.- Parameters:
args
- arguments array passed to script engine.appLoader
- class loader to be used as script "app" class loader.classFilter
- class filter to use.- Returns:
- newly created script engine.
- Throws:
NullPointerException
- ifargs
orclassFilter
isnull
SecurityException
- if the security manager'scheckPermission
deniesRuntimePermission("nashorn.setConfig")
-
-