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

io.javalin.plugin.openapi.utils.LazyDefaultValue.kt Maven / Gradle / Ivy

The newest version!
package io.javalin.plugin.openapi.utils

import kotlin.reflect.KProperty

internal class LazyDefaultValue(private val init: () -> T) {
    var value: T? = null

    operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
        value = value ?: init()
        return value!!
    }

    operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) {
        this.value = value
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy