[英]Runtime dependency from an abstract base class
I'm using Dagger Android 2.19 and my structure is an abstract base fragment and multiple concrete fragment implementations. 我正在使用Dagger Android 2.19,我的结构是一个抽象的基础片段和多个具体的片段实现。 Concrete fragments are used in a ViewPager implementation.
具体的片段用于ViewPager实现中。 Both abstract and concrete class have dependencies.
抽象类和具体类都具有依赖性。 I used corresponding modules for injecting dependencies.
我使用了相应的模块来注入依赖项。
@module
abstract class AbsFragmentModule {
@module
companion object {
@provides
@JvmStatic
fun providesRuntimeDepdendency( fragment : AbsFragment ) : SomeTypeUsingRuntimeDepedency = fragment.getRuntimeDepedency()
}
}
This is the module corresponding to the abstract base fragment. 这是与抽象基本片段相对应的模块。 Dagger is not able to figure out AbsListFragment and fails at compilation.
Dagger无法找出AbsListFragment,并且编译失败。 Is there a way refer to the seed instance here?
有没有办法在这里引用种子实例? If not, is there any workaround?
如果没有,是否有任何解决方法?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.