evant
01/11/2022, 3:02 PM@Provides @IntoSet fun provideFoo(): () -> Foo = { FooImpl() }
evant
01/11/2022, 3:09 PMSet<() -> Foo>
and Set<Lazy<Foo>>
, dagger does do thisdave08
01/11/2022, 3:18 PMevant
01/11/2022, 3:52 PMevant
01/11/2022, 4:15 PM@IntoMap
but I think I could live with itdave08
01/11/2022, 4:17 PMPair
so the instance is already initialized... I guess that's why other DIs use the @IntoMap("keyName")
form instead...evant
01/11/2022, 4:18 PMevant
01/11/2022, 4:18 PMdave08
01/11/2022, 4:20 PM@IntoMap
might be good enough...evant
01/11/2022, 4:20 PMdave08
01/11/2022, 4:25 PM@Provides @IntoMap fun providesFoo(@MapKey key: Bar): Foo
would do the trick... AND allow lazy or provider lambdas but then we're going right back to re-implementing dagger....), but having the option of providing the key in the existing annotation would allow lazy or provider lambdas to work without complicating the DSL.evant
01/11/2022, 4:28 PM@Provides @IntoMap fun proviesFoo(): Pair<String, () -> Foo> = "key" to { FooImpl() }
?dave08
01/11/2022, 4:38 PM@IntoSet
it would be easy to do this, for @IntoMap
you could add a note in the README (and/or in the @IntoMap
kdocs), that it isn't supported and that what you proposed could be done instead...