Guice: inject different implementation depending on who is getting it?
<p>I have two third-party classes, both of which take an implementation of an <code>Authorizer</code> interface. I need to inject each with a different implementation.</p>

<p>If I do an <code>@Provides</code>, how can I implement it so that it provides the implementation required at run time? The provider has no idea who is asking for the injection.</p>

<p>In theory I could use <code>@Named</code>, but I can't modify the code being injected. I want to do something like:</p>

<pre><code>bind(Authorizer.class).to(ImplA.class).for(SomeClass.class)
bind(Authorizer.class).to(ImplB.class).for(SomeOtherClass.class)
</code></pre>

<p>Obviously, the "for" code doesn't exist, but is there some equivalent way to do this?</p>