apatrida
06/30/2016, 11:51 AMapatrida
06/30/2016, 11:51 AMapatrida
06/30/2016, 11:51 AMapatrida
06/30/2016, 11:52 AMsalomonbrys
06/30/2016, 11:52 AMapatrida
06/30/2016, 11:52 AMsalomonbrys
06/30/2016, 11:53 AMapatrida
06/30/2016, 11:53 AMapatrida
06/30/2016, 11:53 AMsalomonbrys
06/30/2016, 11:54 AMapatrida
06/30/2016, 11:54 AMsalomonbrys
06/30/2016, 11:55 AMapatrida
06/30/2016, 11:57 AMFishy
and have separate instances in there that can be tossed away when Fishy
scope completes...apatrida
06/30/2016, 11:58 AMkodein.with(FishInstance).instance<Type>()
and that will give me singletons for FishInstance
as the scopeapatrida
06/30/2016, 11:58 AMapatrida
06/30/2016, 11:58 AMapatrida
06/30/2016, 11:59 AMapatrida
06/30/2016, 12:00 PMfun myScope(): Pair<Context, HashMap<Any, Any>> { /*...*/ }
val kodein = Kodein {
bind<Logger>() with autoScopedSingleton(::myScope) { LogManager.getNamedLogger(it.name) } // `it` is the context.
}
then
val logger: Logger = kodein.instance()
how does the kodein.instance()
know the scope to use?apatrida
06/30/2016, 12:00 PMsalomonbrys
06/30/2016, 12:00 PMapatrida
06/30/2016, 12:00 PMapatrida
06/30/2016, 12:00 PMsalomonbrys
06/30/2016, 12:01 PMapatrida
06/30/2016, 12:01 PMsalomonbrys
06/30/2016, 12:01 PMsalomonbrys
06/30/2016, 12:02 PMapatrida
06/30/2016, 12:02 PMapatrida
06/30/2016, 12:02 PMapatrida
06/30/2016, 12:02 PMsalomonbrys
06/30/2016, 12:03 PMscopedSingleton
, not an autoScopedSingleton