< prev index next >

## src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java

Print this page

      29 import java.util.Collections;
      30 import java.util.List;
      31 import java.util.Objects;
      32 import javax.script.ScriptEngine;
      33 import javax.script.ScriptEngineFactory;
      34 import jdk.nashorn.internal.runtime.Context;
      35 import jdk.nashorn.internal.runtime.Version;
      36
      37 /**
      38  * JSR-223 compliant script engine factory for Nashorn. The engine answers for:
      39  * <ul>
      40  * <li>names {@code "nashorn"}, {@code "Nashorn"}, {@code "js"}, {@code "JS"}, {@code "JavaScript"},
      41  * {@code "javascript"}, {@code "ECMAScript"}, and {@code "ecmascript"};</li>
      42  * <li>MIME types {@code "application/javascript"}, {@code "application/ecmascript"}, {@code "text/javascript"}, and
      43  * {@code "text/ecmascript"};</li>
      44  * <li>as well as for the extension {@code "js"}.</li>
      45  * </ul>
      46  * Programs executing in engines created using {@link #getScriptEngine(String[])} will have the passed arguments
      47  * accessible as a global variable named {@code "arguments"}.
      48  *

      49  * @since 1.8u40
      50  */

      51 public final class NashornScriptEngineFactory implements ScriptEngineFactory {
      52     @Override
      53     public String getEngineName() {
      54         return (String) getParameter(ScriptEngine.ENGINE);
      55     }
      56
      57     @Override
      58     public String getEngineVersion() {
      59         return (String) getParameter(ScriptEngine.ENGINE_VERSION);
      60     }
      61
      62     @Override
      63     public List<String> getExtensions() {
      64         return Collections.unmodifiableList(extensions);
      65     }
      66
      67     @Override
      68     public String getLanguageName() {
      69         return (String) getParameter(ScriptEngine.LANGUAGE);
      70     }
      29 import java.util.Collections;
      30 import java.util.List;
      31 import java.util.Objects;
      32 import javax.script.ScriptEngine;
      33 import javax.script.ScriptEngineFactory;
      34 import jdk.nashorn.internal.runtime.Context;
      35 import jdk.nashorn.internal.runtime.Version;
      36
      37 /**
      38  * JSR-223 compliant script engine factory for Nashorn. The engine answers for:
      39  * <ul>
      40  * <li>names {@code "nashorn"}, {@code "Nashorn"}, {@code "js"}, {@code "JS"}, {@code "JavaScript"},
      41  * {@code "javascript"}, {@code "ECMAScript"}, and {@code "ecmascript"};</li>
      42  * <li>MIME types {@code "application/javascript"}, {@code "application/ecmascript"}, {@code "text/javascript"}, and
      43  * {@code "text/ecmascript"};</li>
      44  * <li>as well as for the extension {@code "js"}.</li>
      45  * </ul>
      46  * Programs executing in engines created using {@link #getScriptEngine(String[])} will have the passed arguments
      47  * accessible as a global variable named {@code "arguments"}.
      48  *
      49  * @deprecated Nashorn JavaScript script engine and APIs, and the jjs tool
      50  * are deprecated with the intent to remove them in a future release.
      51  *
      52  * @since 1.8u40
      53  */
      54 @Deprecated(since="11", forRemoval=true)
      55 public final class NashornScriptEngineFactory implements ScriptEngineFactory {
      56     @Override
      57     public String getEngineName() {
      58         return (String) getParameter(ScriptEngine.ENGINE);
      59     }
      60
      61     @Override
      62     public String getEngineVersion() {
      63         return (String) getParameter(ScriptEngine.ENGINE_VERSION);
      64     }
      65
      66     @Override
      67     public List<String> getExtensions() {
      68         return Collections.unmodifiableList(extensions);
      69     }
      70
      71     @Override
      72     public String getLanguageName() {
      73         return (String) getParameter(ScriptEngine.LANGUAGE);
      74     }

< prev index next >