JniLazy

class JniLazy<out T>(initializer: context(JniEnv, MemScope) () -> T)(source)

Allows declaring lazy values that requires JniEnv to be initialized.

To create an instance of JniLazy use the jniLazy function.

Constructors

Link copied to clipboard
constructor(initializer: context(JniEnv, MemScope) () -> T)

Properties

Link copied to clipboard

Whether the value has been already initialized. Once this property has returned true it stays true for the rest of lifetime of this JniLazy instance.

Link copied to clipboard

Returns the lazily initialized value if it has been initialized, or null otherwise. Doesn't require a JniEnv context.

Link copied to clipboard
context(env: JniEnv)
val value: T

Gets the lazily initialized value of the current JniLazy instance. Once the value was initialized it must not change during the rest of lifetime of this JniLazy instance.