Invoking static methods
This article provides an introduction to cross-technology invocation of static methods when calling a static method from any runtime using any language. The article explains how to invoke any static method, pass arguments and retrieve the results.
With Javonet you can interact with static methods from any runtime like they were available in any language but invocation must be performed through Javonet SDK API, passing the name of the target method as String.
Javonet allows you to pass any any language value type as argument to static method from any runtime. In example: int, float, string, char, long and other. For reference type arguments (instances of other classes) you can create such instance with Javonet and pass the Invocation Context variable referencing that object as argument of static method invocation.
Calling static method from custom any runtime
With Javonet it is possible to reference any custom any runtime and interact with public static methods declared on types defined within that module almost the same as with any other any language library.
This section present sample custom any runtime with class declaring static methods and Javonet SDK syntax required to invoke that methods and consume the results in any language.
Code example below represents the sample code from any runtime that will be used in following sections.
Select technology of module you want to use:
It is possible to invoke one of the declared static methods from any runtime using following any language code. This uses in memory runtime bridging to load the any runtime, and next retrieves reference to specific type and invokes the static method passing value type arguments. Result of the invocation is returned as regular any language value and can be used for further processing.
Select technology of module you want to use:
Calling static methods from standard any runtime
The same steps are required to use types and methods from standard any runtime:
Select technology of module you want to use:
Was this article helpful?