Execute method in GoLang

Because invocation context is building the intent of executing particular expression on target environment, we call the initial state of invocation context as non-materialized. The non-materialized context wraps either single command or chain of recursively nested commands.

// use Activate only once in your app
Javonet.ActivateWithCredentials("your-license-key")

// create called runtime context
calledRuntime, _ := Javonet.InMemory().Jvm()

// construct an invocation context - this invocationContext in non-materialized
invocationContext := calledRuntime.GetType("java.lang.Math").InvokeStaticMethod("abs", -50)

// execute invocation context - this will materialize the invocationContext
response, err := invocationContext.Execute()
if err != nil {
	fmt.Println("Error: " + err.Error())
}

Commands are becoming nested through each invocation of methods on Invocation Context. Each invocation triggers the creation of new Invocation Context instance wrapping the current command with new parent command valid for invoked method.

Developer can decided on any moment of the materialization for the context taking full control of the chunks of the expression being transferred and processed on target runtime.