TomlValue

sealed class TomlValue

Kotlin representation of a TOML value. A full TOML document is always represented as a TomlValue.Map.

You can either traverse this representation manually, access individual properties using TomlValue.get, or decode the whole thing into a data class of your choice using TomlValue.decode.

TomlValue.from can be used to obtain a TomlValue from an input TOML document in the form of a String, java.nio.file.Path, or java.io.InputStream.

Types

Link copied to clipboard
data class Bool(val value: Boolean) : TomlValue.Primitive
Link copied to clipboard
object Companion
Link copied to clipboard
data class Double(val value: Double) : TomlValue.Primitive
Link copied to clipboard
data class Integer(val value: Long) : TomlValue.Primitive
Link copied to clipboard
data class List(val elements: List<TomlValue>) : TomlValue
Link copied to clipboard
data class LocalDate(val value: LocalDate) : TomlValue.Primitive
Link copied to clipboard
Link copied to clipboard
data class LocalTime(val value: LocalTime) : TomlValue.Primitive
Link copied to clipboard
data class Map(val properties: Map<String, TomlValue>) : TomlValue
Link copied to clipboard
Link copied to clipboard
sealed class Primitive : TomlValue
Link copied to clipboard
data class String(val value: String) : TomlValue.Primitive

Inheritors

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

Extensions

Link copied to clipboard
operator fun TomlValue.get(vararg path: String): TomlValue?

Look up the value(s) at the given path in the receiver TOML structure, then decode them into the type given by the type parameter T. If decoding is not possible, a TomlException.DecodingError is thrown. If there is no value at the given path, null is returned.

inline fun <T : Any> TomlValue.get(mapper: TomlMapper, vararg path: String): T?

Look up the value(s) at the given path in the receiver TOML structure, then decode them into the type given by T using the given custom TOML decoder.

fun <T> TomlValue.get(mapper: TomlMapper, targetKType: KType, path: List<String>): T?

Look up the value(s) at the given path in the receiver TOML structure, then decode them into the type given by targetKType using the given custom TOML decoder. targetKType and T should correspond to the same type, or the behavior of get is undefined.