Module org.openjdk.nashorn
Class NashornScriptEngineFactory
java.lang.Object
org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptiongetMethodCallSyntax
(String obj, String method, String... args) getNames()
getOutputStatement
(String toDisplay) getParameter
(String key) getProgram
(String... statements) getScriptEngine
(ClassLoader appLoader) Create a new Script engine initialized with the given class loader.getScriptEngine
(String... args) Create a new Script engine initialized with the given arguments.getScriptEngine
(String[] args, ClassLoader appLoader) Create a new Script engine initialized with the given arguments and the given class loader.getScriptEngine
(String[] args, ClassLoader appLoader, ClassFilter classFilter) Create a new Script engine initialized with the given arguments, class loader and class filter.getScriptEngine
(ClassFilter classFilter) Create a new Script engine initialized with the given class filter.
-
Constructor Details
-
NashornScriptEngineFactory
public NashornScriptEngineFactory()
-
-
Method Details
-
getEngineName
- Specified by:
getEngineName
in interfaceScriptEngineFactory
-
getEngineVersion
- Specified by:
getEngineVersion
in interfaceScriptEngineFactory
-
getExtensions
- Specified by:
getExtensions
in interfaceScriptEngineFactory
-
getLanguageName
- Specified by:
getLanguageName
in interfaceScriptEngineFactory
-
getLanguageVersion
- Specified by:
getLanguageVersion
in interfaceScriptEngineFactory
-
getMethodCallSyntax
- Specified by:
getMethodCallSyntax
in interfaceScriptEngineFactory
-
getMimeTypes
- Specified by:
getMimeTypes
in interfaceScriptEngineFactory
-
getNames
- Specified by:
getNames
in interfaceScriptEngineFactory
-
getOutputStatement
- Specified by:
getOutputStatement
in interfaceScriptEngineFactory
-
getParameter
- Specified by:
getParameter
in interfaceScriptEngineFactory
-
getProgram
- Specified by:
getProgram
in interfaceScriptEngineFactory
-
getScriptEngine
- Specified by:
getScriptEngine
in interfaceScriptEngineFactory
-
getScriptEngine
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
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
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
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
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")
-