ConfigHandle

class ConfigHandle<T : Any>(file: File, clazz: KClass<T>)

Handles the loading and reloading of a configuration file into an instance of type T.

This class provides a managed way to access configuration data, supporting automatic mapping from YAML to Kotlin classes and vice-versa.

Parameters

T

the type of the configuration class

Constructors

Link copied to clipboard
constructor(file: File, clazz: KClass<T>)

Properties

Link copied to clipboard
lateinit var instance: T

The current instance of the configuration.

Functions

Link copied to clipboard
fun load()

Loads the configuration from the file.

Link copied to clipboard

Loads the configuration from the file asynchronously.

Link copied to clipboard
suspend fun loadSuspend(): T

Loads the configuration from the file as a suspending function.

Link copied to clipboard
fun reload()

Reloads the configuration from the file.

Link copied to clipboard

Reloads the configuration from the file asynchronously.

Link copied to clipboard
suspend fun reloadSuspend(): T

Reloads the configuration from the file as a suspending function.