Class JsiiClient

java.lang.Object
software.amazon.jsii.JsiiClient

@Internal public final class JsiiClient extends Object
HTTP client for jsii-server.
  • Constructor Details

    • JsiiClient

      public JsiiClient(JsiiRuntime runtime)
      Creates a new jsii-runtime client.
      Parameters:
      runtime - The JsiiRuntime.
  • Method Details

    • loadModule

      public void loadModule(JsiiModule module)
      Loads a JavaScript module into the remote sandbox.
      Parameters:
      module - The module to load
    • createObject

      public JsiiObjectRef createObject(String fqn, Collection<Object> initializerArgs, Collection<JsiiOverride> overrides, Collection<String> interfaces)
      Creates a remote jsii object.
      Parameters:
      fqn - The fully-qualified-name of the class.
      initializerArgs - Constructor arguments.
      overrides - A list of async methods to override. If a method is defined as an override, a callback will be scheduled when it is called, and the promise it returns will only be fulfilled when the callback is completed.
      Returns:
      A jsii object reference.
    • deleteObject

      public void deleteObject(JsiiObjectRef objRef)
      Deletes a remote object.
      Parameters:
      objRef - The object reference.
    • getPropertyValue

      public com.fasterxml.jackson.databind.JsonNode getPropertyValue(JsiiObjectRef objRef, String property)
      Gets a value for a property from a remote object.
      Parameters:
      objRef - The remote object reference.
      property - The property name.
      Returns:
      The value of the property.
    • setPropertyValue

      public void setPropertyValue(JsiiObjectRef objRef, String property, com.fasterxml.jackson.databind.JsonNode value)
      Sets a value for a property in a remote object.
      Parameters:
      objRef - The remote object reference.
      property - The name of the property.
      value - The new property value.
    • getStaticPropertyValue

      public com.fasterxml.jackson.databind.JsonNode getStaticPropertyValue(String fqn, String property)
      Gets a value of a static property.
      Parameters:
      fqn - The FQN of the class
      property - The name of the static property
      Returns:
      The value of the static property
    • setStaticPropertyValue

      public void setStaticPropertyValue(String fqn, String property, com.fasterxml.jackson.databind.JsonNode value)
      Sets the value of a mutable static property.
      Parameters:
      fqn - The FQN of the class
      property - The property name
      value - The new value
    • callStaticMethod

      public com.fasterxml.jackson.databind.JsonNode callStaticMethod(String fqn, String method, com.fasterxml.jackson.databind.node.ArrayNode args)
      Invokes a static method.
      Parameters:
      fqn - The FQN of the class.
      method - The method name.
      args - The method arguments.
      Returns:
      The return value.
    • callMethod

      public com.fasterxml.jackson.databind.JsonNode callMethod(JsiiObjectRef objRef, String method, com.fasterxml.jackson.databind.node.ArrayNode args)
      Calls a method on a remote object.
      Parameters:
      objRef - The remote object reference.
      method - The name of the method.
      args - Method arguments.
      Returns:
      The return value of the method.
    • beginAsyncMethod

      public JsiiPromise beginAsyncMethod(JsiiObjectRef objRef, String method, com.fasterxml.jackson.databind.node.ArrayNode args)
      Begins the execution of an async method.
      Parameters:
      objRef - The object reference.
      method - The name of the async method.
      args - Arguments for the method.
      Returns:
      A JsiiPromise which represents this method.
    • endAsyncMethod

      public com.fasterxml.jackson.databind.JsonNode endAsyncMethod(JsiiPromise promise)
      Ends the execution of an async method.
      Parameters:
      promise - The promise returned by beginAsyncMethod.
      Returns:
      The method return value.
    • pendingCallbacks

      public List<Callback> pendingCallbacks()
      Dequques all the currently pending callbacks.
      Returns:
      A list of all pending callbacks.
    • completeCallback

      public void completeCallback(Callback callback, String error, String name, com.fasterxml.jackson.databind.JsonNode result)
      Completes a callback.
      Parameters:
      callback - The callback to complete.
      error - Error information (or null).
      name - Error type (or null).
      result - Result (or null).
    • getModuleNames

      public com.fasterxml.jackson.databind.JsonNode getModuleNames(String moduleName)
      Returns all names for a jsii module.
      Parameters:
      moduleName - The name of the module.
      Returns:
      The result (map from "lang" to language configuration).