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

io.smooth.constraint.resolution.ConstraintResolutionBuilder.kt Maven / Gradle / Ivy

The newest version!
package io.smooth.constraint.resolution

import io.smooth.constraint.Constraint
import io.smooth.constraint.ConstraintsService
import javax.inject.Provider
import kotlin.reflect.KClass

suspend inline fun > forConstraint(
    block: ConstraintResolutionBuilder.() -> Unit
) {
    val builder = ConstraintResolutionBuilder()
    block(builder)

    ConstraintsService.getInstance().addConstraintsResolutions(
        C::class,
        builder.getResolutionsProviders()
    )
}

class ConstraintResolutionBuilder> {

    private val resolutionsProviders: MutableList>> =
        arrayListOf()

    fun resolution(vararg resolution: Provider>) {
        resolutionsProviders.addAll(resolution)
    }

    fun getResolutionsProviders(): List>> =
        resolutionsProviders

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy