commonMain.io.mths.kava.processor.options.OfMap.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kava-processor-jvm Show documentation
Show all versions of kava-processor-jvm Show documentation
The KSP Kava Annotation Processor to generate validation extensions.
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)
}