Interface ScriptEngine

All Superinterfaces:
java.lang.AutoCloseable, java.io.Closeable

public interface ScriptEngine
extends java.io.Closeable
A script language implementation.
  • Method Summary

    Modifier and Type Method Description
    default void close()  
    <FactoryType>
    FactoryType
    compile​(java.lang.String name, java.lang.String code, ScriptContext<FactoryType> context, java.util.Map<java.lang.String,​java.lang.String> params)
    Compiles a script.
    java.util.Set<ScriptContext<?>> getSupportedContexts()
    Script contexts supported by this engine.
    java.lang.String getType()
    The language name used in the script APIs to refer to this scripting backend.
  • Method Details

    • getType

      java.lang.String getType()
      The language name used in the script APIs to refer to this scripting backend.
    • compile

      <FactoryType> FactoryType compile​(java.lang.String name, java.lang.String code, ScriptContext<FactoryType> context, java.util.Map<java.lang.String,​java.lang.String> params)
      Compiles a script.
      Parameters:
      name - the name of the script. null if it is anonymous (inline). For a stored script, its the identifier.
      code - actual source of the script
      context - the context this script will be used for
      params - compile-time parameters (such as flags to the compiler)
      Returns:
      A compiled script of the FactoryType from ScriptContext
    • close

      default void close() throws java.io.IOException
      Specified by:
      close in interface java.lang.AutoCloseable
      Specified by:
      close in interface java.io.Closeable
      Throws:
      java.io.IOException
    • getSupportedContexts

      java.util.Set<ScriptContext<?>> getSupportedContexts()
      Script contexts supported by this engine.