bindSingletonOf

inline fun <T : Any> DI.Builder.bindSingletonOf(noinline constructor: () -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)

Binds a singleton: will create an instance on first request and will subsequently always return the same instance.

T generics will be erased!

Parameters

T

The created type.

constructor

The function reference to the T constructor (e.g. :: T)


inline fun <T : Any, P1> DI.Builder.bindSingletonOf(noinline constructor: (P1) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2> DI.Builder.bindSingletonOf(noinline constructor: (P1, P2) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3> DI.Builder.bindSingletonOf(noinline constructor: (P1, P2, P3) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4> DI.Builder.bindSingletonOf(noinline constructor: (P1, P2, P3, P4) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5> DI.Builder.bindSingletonOf(noinline constructor: (P1, P2, P3, P4, P5) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6> DI.Builder.bindSingletonOf(noinline constructor: (P1, P2, P3, P4, P5, P6) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7> DI.Builder.bindSingletonOf(noinline constructor: (P1, P2, P3, P4, P5, P6, P7) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8> DI.Builder.bindSingletonOf(noinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9> DI.Builder.bindSingletonOf(noinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10> DI.Builder.bindSingletonOf(noinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)

See also