commonMain.org.kodein.di.SetBindings.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kodein-di-js Show documentation
Show all versions of kodein-di-js Show documentation
KODEIN Dependency Injection Core
@file:Suppress("unused", "UNCHECKED_CAST")
package org.kodein.di
import org.kodein.di.bindings.*
import org.kodein.type.TypeToken
import org.kodein.type.erasedComp
import org.kodein.type.generic
/**
* Creates a set: multiple bindings can be added in this set.
*
* T generics will be erased!
*
* @param T The created type.
* @return A set binding ready to be bound.
*/
@Suppress("RemoveExplicitTypeArguments")
@Deprecated(
message = "'bind() from ...' has been deprecated",
replaceWith = ReplaceWith("bindSet()"),
level = DeprecationLevel.ERROR
)
public inline fun DI.Builder.setBinding(): SetBinding = SetBinding(TypeToken.Any, generic(), erasedComp(Set::class, generic()) as TypeToken>)
/**
* Creates a set: multiple bindings can be added in this set.
*
* A & T generics will be erased!
*
* @param A The argument type.
* @param T The created type.
* @return A set binding ready to be bound.
*/
@Suppress("RemoveExplicitTypeArguments")
@Deprecated(
message = "'bind() from ...' has been deprecated",
replaceWith = ReplaceWith("bindArgSet()"),
level = DeprecationLevel.ERROR
)
public inline fun DI.Builder.argSetBinding(): ArgSetBinding = ArgSetBinding(TypeToken.Any, generic(), generic(), erasedComp(Set::class, generic()) as TypeToken>)
/**
* Creates a set: multiple bindings can be added in this set.
*
* T generics will be erased!
*
* @param T The created type.
* @return A set binding ready to be bound.
*/
@Suppress("RemoveExplicitTypeArguments")
public inline fun DI.Builder.bindSet(tag: Any? = null, overrides: Boolean? = null): Unit = Bind(tag = tag, overrides = overrides, binding = SetBinding(TypeToken.Any, generic(), erasedComp(Set::class, generic()) as TypeToken>))
/**
* Creates a set: multiple bindings can be added in this set.
*
* T generics will be erased!
*
* @param A The argument type.
* @param T The created type.
* @return A set binding ready to be bound.
*/
@Suppress("RemoveExplicitTypeArguments")
public inline fun DI.Builder.bindArgSet(tag: Any? = null, overrides: Boolean? = null): Unit = Bind(tag = tag, overrides = overrides, binding = ArgSetBinding(TypeToken.Any, generic(), generic(), erasedComp(Set::class, generic()) as TypeToken>))
/**
* Defines that the binding will be saved in a set binding.
*
* T generics will be erased!
*
* @param T The type of the binding.
*/
public inline fun DI.Builder.TypeBinder.inSet(): TypeBinderInSet> = InSet(erasedComp(Set::class, generic()) as TypeToken>)
/**
* Defines that the binding will be saved in a set binding.
*
* T generics will be erased!
*
* @param T The type of the binding.
*/
public inline fun DI.Builder.inSet(tag: Any? = null, overrides: Boolean? = null, creator: () -> DIBinding<*, *, T>): Unit = BindSet(tag = tag, overrides = overrides, creator())
© 2015 - 2024 Weber Informatics LLC | Privacy Policy