Class PolyglotAccess

java.lang.Object
org.graalvm.polyglot.PolyglotAccess

public final class PolyglotAccess extends Object
Represents an access policy for polyglot builtins in the guest languages.

If the two predefined access policies NONE and ALL are not sufficient then a custom access configuration may be created using newBuilder(). This allows to grant individual access rights between the language.

The following access rights may be granted:

  • The ability to evaluate code between two or just for one language. If a language has access to at least one other language then the polyglot eval builtin will be available, otherwise access to that builtin might be restricted. The concrete name of the polyglot eval builtin is language specific. In JavaScript it is called Polyglot.eval.
  • The ability to access members in the polyglot bindings. The names of the guest language builtins to access polyglot bindings are language specific. In JavaScript they are called Polyglot.import and Polyglot.export.
Access to polyglot evaluation and bindings builtins are always enabled when access policy ALL is used. In this mode polyglot evaluation builtins are available even if there is just one installed language available.
Since:
19.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    final class 
    A builder for a polyglot access configuration.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final PolyglotAccess
    Provides guest languages full access to other languages using polyglot evaluation and binding builtins.
    static final PolyglotAccess
    Provides guest languages no access to other languages using polyglot builtins evaluation and binding builtins.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new custom polyglot access configuration builder.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NONE

      public static final PolyglotAccess NONE
      Provides guest languages no access to other languages using polyglot builtins evaluation and binding builtins.
      Since:
      19.0
    • ALL

      public static final PolyglotAccess ALL
      Provides guest languages full access to other languages using polyglot evaluation and binding builtins.
      Since:
      19.0
  • Method Details

    • newBuilder

      public static PolyglotAccess.Builder newBuilder()
      Creates a new custom polyglot access configuration builder. A polyglot access builder starts with no access rights.
      Since:
      19.2