config / org.apache.tuweni.config / Configuration

Configuration

interface Configuration (source)

Represents collection of configuration properties, optionally validated against a schema.

Functions

canonicalKey

open static fun canonicalKey(key: String): String

Get the canonical form of a configuration key.

contains

abstract fun contains(key: String): Boolean

Check if a key is set in this configuration.

empty

open static fun empty(): Configuration

Get an empty configuration, with no values.

open static fun empty(schema: Schema?): Configuration

Get an empty configuration, associated with a validation schema.

errors

abstract fun errors(): MutableList<ConfigurationError>

The errors that occurred during parsing.

fromToml

open static fun fromToml(toml: String): Configuration

Read a configuration from a TOML-formatted string.

open static fun fromToml(toml: String, schema: Schema?): Configuration

Read a configuration from a TOML-formatted string, associated with a validation schema.

open static fun fromToml(file: Path): Configuration
open static fun fromToml(is: InputStream): Configuration

Loads a configuration from a TOML-formatted file.

open static fun fromToml(file: Path, schema: Schema?): Configuration
open static fun fromToml(is: InputStream, schema: Schema?): Configuration

Loads a configuration from a file, associated with a validation schema.

get

abstract fun get(key: String): Any?

Get an object from this configuration.

getBoolean

abstract fun getBoolean(key: String): Boolean

Get a boolean from this configuration.

getDouble

abstract fun getDouble(key: String): Double

Get a double from this configuration.

getInteger

abstract fun getInteger(key: String): Int

Get an integer from this configuration.

getList

abstract fun getList(key: String): MutableList<Any>

Get a list from this configuration.

getListOfBoolean

abstract fun getListOfBoolean(key: String): MutableList<Boolean>

Get a list of booleans from this configuration.

getListOfDouble

abstract fun getListOfDouble(key: String): MutableList<Double>

Get a list of doubles from this configuration.

getListOfInteger

abstract fun getListOfInteger(key: String): MutableList<Int>

Get a list of integers from this configuration.

getListOfLong

abstract fun getListOfLong(key: String): MutableList<Long>

Get a list of longs from this configuration.

getListOfMap

abstract fun getListOfMap(key: String): MutableList<MutableMap<String, Any>>

Get a list of maps from this configuration.

getListOfString

abstract fun getListOfString(key: String): MutableList<String>

Get a list of strings from this configuration.

getLong

abstract fun getLong(key: String): Long

Get a long from this configuration.

getMap

abstract fun getMap(key: String): MutableMap<String, Any>

Get a map from this configuration.

getString

abstract fun getString(key: String): String

Get a string from this configuration.

hasErrors

open fun hasErrors(): Boolean

inputPositionOf

abstract fun inputPositionOf(key: String): DocumentPosition?

Get the position where a key is defined in the TOML document.

keySet

abstract fun keySet(): MutableSet<String>

The keys of all entries present in this configuration.

toToml

open fun toToml(): String

Get a TOML-formatted representation of this configuration.

open fun toToml(path: Path): Unit

Save a configuration to a TOML-formatted file.

If necessary, parent directories for the output file will be created.

abstract fun toToml(appendable: Appendable): Unit

Writes a configuration in TOML format.