Comment #5 on issue 809 by sberlin: Guice Assisted Inject with multiple implementations of interface
http://code.google.com/p/google-guice/issues/detail?id=809

Correct, (1) turns the original factory into a delegate and the shim is the real factory (delegating to the delegate). The delegate's really just an implementation detail, though, and the interface could be package-private, etc.

(2) would be done with something like:
  interface Factory {
    @Named("BC") A create(int foo, int bar);
    @Named("D") A create();
  }
  Module extends PrivateModule {
    @Override public void configure() {
      install(new FactoryModuleBuilder()
          implement(Key.get(A.class, Names.named("BC"), targetBCClazz)
          implement(Key.get(A.class, Names.named("D"), targetDClazz)
          build(AFactory.class));
          // + bind to named type, expose
    }
  }
  install(getAFactoryModule("B", B.class, D.class));
  install(getAFactoryModule("C", C.class, D.class));

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to