Static fields and properties

This article provides an introduction to cross-technology handling of static fields and properties from any runtime using any language. The article explains how to get and set any static field/property.

With Javonet you can interact with static fields and properties from any runtime like they were available in any language but invocation must be performed through Javonet SDK API, passing the name of the field or property as string.

Get/Set static field from custom any runtime

With Javonet it is possible to reference any custom any runtime and interact with public static fields and properties 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 field and Javonet SDK syntax required to use that field and consume the results in any language.

Code example below represents the sample code from any runtime that will be used in following sections.

It is possible to get one of the declared static fields 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 gets the static field. 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:

To set static field/property from the custom any runtime:

Select technology of module you want to use:

Get/Set static field from standard any runtime

The same steps are required to use types and fields from standard any runtime:

Select technology of module you want to use: