Sometimes, for architectural reasons, I have interfaces with only one concrete class implementing them. Writing @Provides methods for these cases can involve a lot of boilerplate, especially if the constructor has a lot of dependencies.
e.g.
@Provides
@ActivityScope
public FavouritesListContract.Presenter provideFavouritesListPresenter(FavouritesClient favouritesClient,
SearchStorage searchStorage, SettingsStorage settingsStorage, GoogleAnalyticsHelper googleAnalyticsHelper) {
return new FavouritesListPresenter(favouritesClient, searchStorage, settingsStorage, googleAnalyticsHelper);
}
As long as the concrete implementation has an @Inject constructor it ought to be possible to just bind the class to the interface.
My thinking is that the binding still belongs in a Module. Perhaps a list of bindings could be provided in the @Module annotation?
Sometimes, for architectural reasons, I have interfaces with only one concrete class implementing them. Writing
@Providesmethods for these cases can involve a lot of boilerplate, especially if the constructor has a lot of dependencies.e.g.
As long as the concrete implementation has an
@Injectconstructor it ought to be possible to just bind the class to the interface.My thinking is that the binding still belongs in a
Module. Perhaps a list of bindings could be provided in the@Moduleannotation?