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

com.lightningkite.khrysalis.context.Contexts.kt Maven / Gradle / Ivy

The newest version!
package com.lightningkite.khrysalis.context

import kotlin.reflect.KProperty

class ContextProperty() {
    var value: T? = null
    operator fun getValue(thisRef: Any?, property: KProperty<*>): T {
        return value!!
    }
    inline fun context(value: T, action: ()->Unit){
        if(this.value != null) throw IllegalStateException()
        this.value = value
        action()
        this.value = null
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy