Dagger Error: "The @AssistedFactory-annotated type should contain a single abstract, non-default method but found multiple"

Dagger Error: "The @AssistedFactory-annotated type should contain a single abstract, non-default method but found multiple"

正在学习使用Dagger和辅助注入,有如下工厂接口

@AssistedFactory
public interface IFactory{

  HandlerA createHandlerA (String path);
  HandlerB createHandlerB (String path);
  HandlerC createHandlerC (String path);
  HandlerD createHandlerD (String path);
}

当我尝试编译时,我收到一条消息:

The @AssistedFactory-annotated type should contain a single abstract, non-default method but found multiple

API 文档说了同样的话,但我真的不明白它的意思,非常感谢任何解释,以及建议以及如何 fix/avoid 它在未来。谢谢!

它说你想要

@AssistedFactory
public interface IFactoryA {    
  HandlerA createHandlerA (String path);
}

@AssistedFactory
public interface IFactoryB {
  HandlerB createHandlerB (String path);
}

@AssistedFactory
public interface IFactoryC {
  HandlerC createHandlerC (String path);
}

@AssistedFactory
public interface IFactoryD {
  HandlerD createHandlerD (String path);
}