bindSingletonOf

inline fun <T : Any> DI.Builder.bindSingletonOf(crossinline 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(crossinline constructor: (P1) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3> DI.Builder.bindSingletonOf(crossinline 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(crossinline 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(crossinline 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(crossinline 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(crossinline 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(crossinline 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(crossinline 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(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)
inline fun <T : Any, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22> DI.Builder.bindSingletonOf(crossinline constructor: (P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16, P17, P18, P19, P20, P21, P22) -> T, tag: Any? = null, overrides: Boolean? = null, sync: Boolean = true)

See also