All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.mths.kava.processor.options.OfMap.kt Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package io.mths.kava.processor.options

import kotlin.reflect.KProperty

fun KavaOptions.Companion.of(
    options: Map
) = KavaOptions(
    separateFiles =
        options[KavaOptions::separateFiles].toBoolean(),
    inferPackage =
        options[KavaOptions::inferPackage].toBoolean(),
    generatedPackage =
        options[KavaOptions::generatedPackage] ?: Defaults.generatedPackage,
    generatedFileName =
        options[KavaOptions::generatedFileName] ?: Defaults.generatedFileName,
    generatedFileExtension =
        options[KavaOptions::generatedFileExtension] ?: Defaults.generatedFileExtension
)

internal operator fun Map.get(
    optionProperty: KProperty<*>
): String? {
    val key = keys.findQualifiedOption(optionProperty)
        ?: return null

    return get(key)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy