src/jdk/nashorn/internal/runtime/GlobalObject.java

Print this page




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.nashorn.internal.runtime;
  27 
  28 import java.lang.invoke.MethodHandle;
  29 import java.util.concurrent.Callable;
  30 import jdk.internal.dynalink.linker.GuardedInvocation;
  31 import jdk.internal.dynalink.linker.LinkRequest;
  32 import jdk.nashorn.internal.runtime.linker.InvokeByName;
  33 
  34 /**
  35  * Runtime interface to the global scope objects.
  36  */
  37 
  38 public interface GlobalObject {
  39     /**












  40      * Initialize standard builtin objects like "Object", "Array", "Function" etc.
  41      * as well as our extension builtin objects like "Java", "JSAdapter" as properties
  42      * of the global scope object.
  43      */
  44     public void initBuiltinObjects();
  45 
  46     /**
  47      * Wrapper for {@link jdk.nashorn.internal.objects.Global#newScriptFunction(String, MethodHandle, ScriptObject, boolean)}
  48      *
  49      * @param name   function name
  50      * @param handle invocation handle for function
  51      * @param scope  the scope
  52      * @param strict are we in strict mode
  53      *
  54      * @return new script function
  55      */
  56    public ScriptFunction newScriptFunction(String name, MethodHandle handle, ScriptObject scope, boolean strict);
  57 
  58     /**
  59      * Wrapper for {@link jdk.nashorn.internal.objects.Global#wrapAsObject(Object)}




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.nashorn.internal.runtime;
  27 
  28 import java.lang.invoke.MethodHandle;
  29 import java.util.concurrent.Callable;
  30 import jdk.internal.dynalink.linker.GuardedInvocation;
  31 import jdk.internal.dynalink.linker.LinkRequest;
  32 import jdk.nashorn.internal.runtime.linker.InvokeByName;
  33 
  34 /**
  35  * Runtime interface to the global scope objects.
  36  */
  37 
  38 public interface GlobalObject {
  39     /**
  40      * Is this global of the given Context?
  41      * @return true if this global belongs to the given Context
  42      */
  43     public boolean isOfContext(Context context);
  44 
  45     /**
  46      * Does this global belong to a strict Context?
  47      * @return true if this global belongs to a strict Context
  48      */
  49     public boolean isStrictContext();
  50 
  51     /**
  52      * Initialize standard builtin objects like "Object", "Array", "Function" etc.
  53      * as well as our extension builtin objects like "Java", "JSAdapter" as properties
  54      * of the global scope object.
  55      */
  56     public void initBuiltinObjects();
  57 
  58     /**
  59      * Wrapper for {@link jdk.nashorn.internal.objects.Global#newScriptFunction(String, MethodHandle, ScriptObject, boolean)}
  60      *
  61      * @param name   function name
  62      * @param handle invocation handle for function
  63      * @param scope  the scope
  64      * @param strict are we in strict mode
  65      *
  66      * @return new script function
  67      */
  68    public ScriptFunction newScriptFunction(String name, MethodHandle handle, ScriptObject scope, boolean strict);
  69 
  70     /**
  71      * Wrapper for {@link jdk.nashorn.internal.objects.Global#wrapAsObject(Object)}