Invocation context from JAR library in GoLang app
Calling any method on Runtime Context creates new instance of Invocation Context.
// 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())
}
Navigation through the methods on different variations of Invocation Context allows to construct the chain of invocations. Those chains of invocation represent the non-materialized expression of interaction with libraries, types, and any programming entities in target technology.
In order to materialize expression, a call to called technology needs to be invoked with Execute method
Was this article helpful?