Loadable

abstract class Loadable<T>

A slighter more complicated and more advanced version of Closeable

Parameters

T

the type of the object to be loaded

Constructors

Link copied to clipboard
fun Loadable()

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Functions

Link copied to clipboard
operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun get(force: Boolean = false): Result<T>

Attempts to get the value of this loadable. If it isn't loaded it will try using the load method. If there is an exception thrown, or predicateLoadable returns false this will return null.

Link copied to clipboard
override fun hashCode(): Int
Link copied to clipboard
suspend fun load(force: Boolean = false): Result<T>

Attempts to load the value of this loadable. If force loaded, and the value is already loaded, it will run unload before getting a new instance.

Link copied to clipboard
abstract suspend fun onLoad(): T

The function to be called when the value is to be loaded.

Link copied to clipboard
open suspend fun onUnload(value: T)

The function to be called when the value is to be unloaded.

Link copied to clipboard
override fun toString(): String
Link copied to clipboard
suspend fun unload(): Boolean

Attempts to unload the value of this loadable.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard