Hocon

sealed class Hocon : SerialFormat

Allows deserialization of Config object from popular Lightbend/config library into Kotlin objects.

Config object represents "Human-Optimized Config Object Notation" — https://github.com/lightbend/config#using-hocon-the-json-superset.

Duration objects are encoded/decoded using "HOCON duration format" - Duration format[https://github.com/lightbend/config/blob/main/HOCON.md#duration-format] [Duration] objects encoded using time unit short names: d, h, m, s, ms, us, ns. Encoding use the largest time unit. Example: 120.seconds -> 2 m 121.seconds -> 121 s 120.minutes -> 2 h 122.minutes -> 122 m 24.hours -> 1 d All restrictions on the maximum and minimum duration are specified in Duration.

Parameters

useConfigNamingConvention

switches naming resolution to config naming convention (hyphen separated).

serializersModule

A SerializersModule which should contain registered serializers for Contextual and Polymorphic serialization, if you have any.

Types

Link copied to clipboard
object Default : Hocon

The default instance of Hocon parser.

Functions

Link copied to clipboard
fun <T> decodeFromConfig(deserializer: DeserializationStrategy<T>, config: Config): T

Decodes the given config into a value of type T using the given serializer.

Link copied to clipboard
fun <T> encodeToConfig(serializer: SerializationStrategy<T>, value: T): Config

Encodes the given value into a Config using the given serializer.

Properties

Link copied to clipboard
open override val serializersModule: SerializersModule

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
inline fun <T> Hocon.decodeFromConfig(config: Config): T

Decodes the given config into a value of type T using a deserializer retrieved from the reified type parameter.

Link copied to clipboard
inline fun <T> Hocon.encodeToConfig(value: T): Config

Encodes the given value of type T into a Config using a serializer retrieved from the reified type parameter.