decode
Decodes the receiver TOML value to the type indicated by type parameter T
using the default TOML decoder. If the value can't be decoded into the target type, a TomlException.DecodingError is thrown.
TOML types can be decoded to Kotlin types as follows:
List: List, MutableList, Collection or Iterable
Map: Map, MutableMap, SortedMap, or any class with primary constructor fields corresponding to the keys of the TOML document.
Bool: Boolean
Double: Double, Float or BigDecimal
Integer: Int, Long, Float, Double, BigDecimal or BigInteger
String: String
LocalDate: LocalDate
LocalTime: LocalTime
LocalDateTime: LocalDateTime
OffsetDateTime: OffsetDateTime
Additionally, any subclass of TomlValue can always be decoded into itself.
Decodes the receiver TOML value into a value of the type corresponding to the given KType
. T
and type
should correspond to the same type, or the behavior of decode
is undefined.
Decodes the receiver TOML value into a value of type T
, using the given custom decoder.
Decodes the receiver TOML value into a value of the type corresponding to the given KType
, using the given custom decoder. T
and type
should correspond to the same type, or the behavior of decode
is undefined.