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:
getEngineNamein interfaceScriptEngineFactory
-
getEngineVersion
- Specified by:
getEngineVersionin interfaceScriptEngineFactory
-
getExtensions
- Specified by:
getExtensionsin interfaceScriptEngineFactory
-
getLanguageName
- Specified by:
getLanguageNamein interfaceScriptEngineFactory
-
getLanguageVersion
- Specified by:
getLanguageVersionin interfaceScriptEngineFactory
-
getMethodCallSyntax
- Specified by:
getMethodCallSyntaxin interfaceScriptEngineFactory
-
getMimeTypes
- Specified by:
getMimeTypesin interfaceScriptEngineFactory
-
getNames
- Specified by:
getNamesin interfaceScriptEngineFactory
-
getOutputStatement
- Specified by:
getOutputStatementin interfaceScriptEngineFactory
-
getParameter
- Specified by:
getParameterin interfaceScriptEngineFactory
-
getProgram
- Specified by:
getProgramin interfaceScriptEngineFactory
-
getScriptEngine
- Specified by:
getScriptEnginein 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'scheckPermissiondeniesRuntimePermission("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- ifclassFilterisnullSecurityException- if the security manager'scheckPermissiondeniesRuntimePermission("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- ifargsisnullSecurityException- if the security manager'scheckPermissiondeniesRuntimePermission("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- ifargsisnullSecurityException- if the security manager'scheckPermissiondeniesRuntimePermission("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- ifargsorclassFilterisnullSecurityException- if the security manager'scheckPermissiondeniesRuntimePermission("nashorn.setConfig")
-