I've been playing around with ToothPick DI and I'm on a situation where I need to inject a couple of generics to a presenter and I don't know how to do it, or if it's even possible. Here's an example of what I'm trying to do.
This is an example of presenter:
@InjectConstructor
class MyPresenter(
private val interactor1: Interactor1,
private val interactor2: Interactor2,
private val issuesList: List<Issue>,
private val navigator: Page<Parameter>) {
......
}
Let's imagine that interactor1 and interactor2 are correctly injected via annotations or modules, but the List and the Page are still missing to bind.
class MyActivity: Activity {
private val listOfIssues: List<Issue> = ...
private val navigationPage: Page<Parameter> = ....
@Override fun onCreate(savedInstanceState: Bundle?) {
Toothpick.openRootScope()
.openSubScope(this)
.installModules(module {
bind(??).toInstance(listOfIssues)
bind(??).toInstance(navigationPage)
})
}
}
In my experience I cannot bind Page or List with Toothpick as it cannot inject generic types, am I wrong?
Thanks!