In Dagger 2, is it possible to inject a Map<Class<? extends Foo>, Provider<? extends Foo>>
?
Suppose, I have a couple of classes that extends Foo
class Bar extends Foo {
@Inject Bar() {}
}
class Baz extends Foo {
@Inject Baz() {}
}
and now I want to create a FooFactory
by declaring
class FooFactory {
@Inject FooFactory(Map<Class<? extends Foo>, Provider<? extends Foo>> providers) {}
}
Can I do this in Dagger 2 with minimal configuration? I've read about Multibinding but I couldn't get it to work.