Class JavaScriptValues

java.lang.Object
com.axelor.script.JavaScriptValues

public final class JavaScriptValues extends Object
Converts GraalVM guest Values into plain, context-independent Java objects.

Shallow conversion via v.as(List.class) / v.as(Map.class) yields a live proxy bound to the polyglot context that produced it; once that context closes, any access throws "Context is already closed". This converter eagerly materialises arrays and objects into plain ArrayList/LinkedHashMap, so results are safe to read after the context is gone.

  • Method Details

    • toHost

      public static Object toHost(org.graalvm.polyglot.Value v)
      Deep-convert a guest Value to a durable, context-independent Java object.
    • materialize

      public static Object materialize(Object o)
      Deep-copy a host object graph into durable collections. Guest object/array literals passed to host methods (e.g. response.setValue('field', {id: 1})) become live Map/ List proxies bound to the polyglot context; this copies them into plain LinkedHashMap/ArrayList while the context is open, so they survive its close. Non-collection values are already durable and returned as-is.