3

Assisted Injection を使用しているときに、私が乗り越えることができない奇妙なエラーが発生しています。

[DEBUG] [project] - Rebinding com.gwtplatform.mvp.client.DesktopGinjector
[DEBUG] [project] - Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
    [ERROR] [project] - Factory com.jorsek.editor.gin.EditorClientFactory could not be created
    [ERROR] [project] - Error injecting com.jorsek.editor.gin.EditorClientFactory: Unable to create or inherit binding: No @Inject or default constructor found for com.jorsek.editor.gin.EditorClientFactory

必要なノードへのパス:

com.projectname.client.application.resourceworkspace.ResourceWorkspacePresenter [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:122)] -> com.jorsek.editor.gin.EditorClientFactory [@Inject com のコンストラクター.projectname.client.application.resourceworkspace.ResourceWorkspacePresenter]

すべてをセットアップする方法は次のとおりです。

私の工場:

public interface EditorClientFactory {

/**
 * Create a new DOMModel via assisted injection initializing the model 
 * with the document entity and it's DOM document content.
 * 
 * @param document
 * @param domDocument
 * @return
 */
public DOMModel create(Entity document, Document domDocument);
}

私のモジュール:

public class EditorClientModule extends AbstractGinModule {

@Override
protected void configure() {

    install(new GinFactoryModuleBuilder().build(EditorClientFactory.class));

    bind(DOMModel.class).to(SyncedDOMModel.class);
}

}

com.jorsek.editor.impl.SyncedDOMModel:

public class SyncedDOMModel implements DOMModel {



@Inject
private SyncedDOMModel(){} /* For GIN/GUICE */

@AssistedInject
public SyncedDOMModel(CollabClient client, CollabClientFactory collabFactory, @Assisted Entity ref, @Assisted Document domDoc){
    }
}

これは、使用するために工場を注入しようとしている方法です。

@AssistedInject
public ResourceWorkspacePresenter(final EventBus eventBus, final MyView view, final MyProxy proxy, APIService apiService, EditorClientFactory editorFactory, @Assisted EntityLocator entityLocator) {
    super(eventBus, view, proxy, ApplicationPresenter.TYPE_SetMainContent);


    this.editorFactory = editorFactory;
    this.apiService = apiService;
     System.out.println("E Locator: " + entityLocator);

}

そして、これは私が自分の工場を使用しようとしている方法です(ただし、これまでに到達することはありません):

editorFactory.create(doc, domDoc);

なぜこれが起こるのか誰にもわかりますか?

それが役立つ場合、私はGWTP RC2を使用しています。

ありがとう、

ケーシー

4

1 に答える 1

4

あなたのコードは正しくありません (それで問題が解決するかどうかはわかりませんが、それが始まりです):bind(DOMModel.class)工場に次のように伝えるべきではありません:

install(new GinFactoryModuleBuilder()
    .implement(DOMModel.class, SyncedDOMModel.class)
    .build(EditorClientFactory.class));
于 2013-05-01T09:07:42.867 に答える