ConfigWrapper

interface ConfigWrapper

An abstraction for an underlying configuration store. Decouples config delegates from the underlying config framework.

Functions

Link copied to clipboard
abstract fun addDefault(path: String, value: Any)

Adds a default value to be used in absence of a value provided by the client.

Link copied to clipboard
abstract fun getBoolean(path: String): Boolean

Gets the specified Boolean configuration value. If the value is not set or not a valid boolean, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getBooleanList(path: String): List<Boolean>

Gets the specified List of Boolean configuration value. If the value is not set or not a valid boolean list, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getComments(path: String): List<String>

Returns the YAML comments above the given path, or an empty list if none.

Link copied to clipboard
abstract fun getDouble(path: String): Double

Gets the specified Double configuration value. If the value is not set or not a valid double, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getDoubleList(path: String): List<Double>

Gets the specified List of Double configuration value. If the value is not set or not a valid double list, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getInt(path: String): Int

Gets the specified Int configuration value. If the value is not set or not a valid integer, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getIntegerList(path: String): List<Int>

Gets the specified List of Int configuration value. If the value is not set or not a valid integer list, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getKeys(deep: Boolean): Set<String>

Gets all keys present in the config store.

Link copied to clipboard
abstract fun getLong(path: String): Long

Gets the specified Long configuration value. If the value is not set or not a valid long, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getLongList(path: String): List<Long>

Gets the specified List of Long configuration value. If the value is not set or not a valid long list, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getMap(path: String): Map<String, Any>

Gets the specified flat Map of Any indexed by String configuration value. If the value is not set or not a valid Map, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getString(path: String): String

Gets the specified String configuration value. If the value is not set or not a valid string, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun getStringList(path: String): List<String>

Gets the specified List of String configuration value. If the value is not set or not a valid string list, the default value provided by addDefault is returned.

Link copied to clipboard
abstract fun reloadConfig()

Reloads all configuration values from the underlying config representation, for example from file.

Link copied to clipboard
abstract fun remove(path: String)

Removes the value at the specified path.

Link copied to clipboard
abstract fun save()

Persists any changes in configuration values to disk. WARNING: overwrites any changes done to the config file on disk!

Link copied to clipboard
abstract fun saveDefaults()

Stores the default values provided by addDefault for any path that has no user provided value. If the underlying config representation does not exist, it is created and initiated with the default values.

Link copied to clipboard
abstract fun set(path: String, value: Any?)

Sets the value in the underlying config. Use save to persist changes.

Link copied to clipboard
abstract fun setComments(path: String, comments: List<String>)

Sets the YAML comments above the given path. Applied on the next save.