ConfigLoader

class ConfigLoader<U : Config>(val path: String, val factory: (Map<String, String>) -> U)

Loads and manages configuration from Java properties files.

This loader automatically:

  • Creates configuration files if they don't exist

  • Adds missing keys with default values

  • Reads and parses properties files

  • Provides type-safe access through Config implementations

Parameters

U

The Config subclass type to instantiate with loaded values.

Constructors

Link copied to clipboard
constructor(path: String, factory: (Map<String, String>) -> U)

Properties

Link copied to clipboard
val factory: (Map<String, String>) -> U

Function to construct the Config instance from a key-value map.

Link copied to clipboard

File path to the configuration properties file.

Functions

Link copied to clipboard
fun loadConfig(): U

Loads configuration from the properties file at the specified path.

Link copied to clipboard
fun saveConfig(config: U)

Saves a configuration instance to the properties file.