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

plugability.LazyEvaluated.kt Maven / Gradle / Ivy

Go to download

Dokka is an API documentation engine for Kotlin and Java, performing the same function as Javadoc for Java

There is a newer version: 2.0.0
Show newest version
package org.jetbrains.dokka.plugability

internal class LazyEvaluated private constructor(private val recipe: ((DokkaContext) -> T)? = null, private var value: T? = null) {

    @Synchronized
    internal fun get(context: DokkaContext): T {
        if(value == null) {
            value = recipe?.invoke(context)
        }
        return value ?: throw AssertionError("Incorrect initialized LazyEvaluated instance")
    }

    companion object {
        fun  fromInstance(value: T) = LazyEvaluated(value = value)
        fun  fromRecipe(recipe: (DokkaContext) -> T) = LazyEvaluated(recipe = recipe)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy