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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to