I've tried to offer a better solution that uses Kotlin. So maybe it has 
gotten better over the years finally?

https://github.com/google/guice/issues/906#issuecomment-500033982

On Monday, February 8, 2016 at 12:53:40 PM UTC-5, Matthew Madson wrote:
>
> I don't suppose this has gotten less lame over the years?
>
> On Tuesday, March 3, 2009 at 6:21:45 PM UTC-8, Jesse Wilson wrote:
>>
>> Regretfully, multibindings cannot span injectors and therefore they 
>> cannot span private modules. This sucks!  But there's a (lame) 
>> workaround. Expose a key in the private module, and multibind it in a 
>> regular module: 
>>
>>   Injector injector = Guice.createInjector( 
>>       new PrivateModule() { 
>>         public void configure() { 
>>           bind(Key.get(Source.class, named("one"))).to 
>> (SourceImpl.class); 
>>           expose(Key.get(Source.class, named("one"))); 
>>           ... 
>>         } 
>>       }, 
>>       new PrivateModule() { 
>>         public void configure() { 
>>           bind(Key.get(Source.class, named("two"))).to 
>> (SourceImpl.class); 
>>           expose(Key.get(Source.class, named("two"))); 
>>           ... 
>>         } 
>>       }, 
>>       new Module() { 
>>         public void configure() { 
>>           Multibinder<Source> multibinder 
>>               = Multibinder.newSetBinder(binder(), Source.class); 
>>           multibinder.addBinding().to(Key.get(Source.class, named 
>> ("one"))); 
>>           multibinder.addBinding().to(Key.get(Source.class, named 
>> ("two"))); 
>>         } 
>>       }); 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" 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 https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/8f439344-c5bd-4d08-869e-bc7d8a5f98e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to