在匕首subcomponent
中声明module annotation
的用例是什么?例如
@Module(subcomponents = ChildComponent.class)
public class ModuleB
我已经阅读了文档,但是找不到任何用法示例。
Any {@link Subcomponent}- or {@code @ProductionSubcomponent}-annotated classes which should be
* children of the component in which this module is installed. A subcomponent may be listed in
* more than one module in a component.
答案 0 :(得分:0)
您可以指定子组件类,这些子组件类应取决于模块所属的组件。
我有组件A
和模块ModuleA
和组件B
。如果您在subcomponents = B.class
中指定ModuleA
,则匕首将不会编译为
error: A doesn't have a @Subcomponent.Builder, which is required when used with @Module.subcomponents
@Module(subcomponents = {B.class})
^
除非组件B
是A
的子组件。