Seems like a variant of the common robot legs issue:

http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions#How_do_I_build_two_similar_but_slightly_different_trees_of_objec


On Mon, Jul 2, 2012 at 10:03 PM, Dan <csniki...@google.com> wrote:

> Hello everyone.
>
> I have an object that takes several injected arguments. All of them are
> provided by separate modules. The last argument is actually provided by two
> different modules - A and B. I have an injector that is created from all of
> these modules. I want to create two different instances of an object - one
> whose last argument came from module A, and the other whose last argument
> from module B. All the other arguments are the same.
>
> I solved it by making an annotated @Provides method in each of the modules
> where they make the last argument @Named after their own, leaving the rest
> untouched.
>
> But I feel like this is not a good solution, because I don't want modules
> A and B to even know how many arguments there are in the object's
> constructor. Is there a way I could say something like "For a class X, bind
> it's argument of type Y to such annotated instance" without specifying
> anything about other arguments?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-guice/-/wqvXqFOZ4HUJ.
> To post to this group, send email to google-guice@googlegroups.com.
> To unsubscribe from this group, send email to
> google-guice+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-guice?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-guice@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to