Thanks for pointing at that class. Have missed it completely.

But now I have a generics related problem with the compiler. I can fix
it using casts but I'd like to understand my error: Could anyone give me
a hint why this code does not compile?

binder.bind( Key.get( Types.newParameterizedType( Collection.class,
Types.subtypeOf( Integer.class ) ) ) ).to( Key.get( Types.setOf(
Integer.class ) ) );


Sincerly,

Johannes

[email protected] wrote:
> 
> 
> On Oct 15, 6:42 am, Johannes Schneider <[email protected]> wrote:
>> This is necessary because I inject the strategies using a parameter of
>> type "Collection<? extends ImageSelectionStrategy>".
>> Could that not-so-readable part with the type literals be skipped
>> somehow? I think that is quite a common use case and maybe should be
>> added to the multibinder?
> 
> I think a your one-statement is the right fix here. If you write this
> too often, you can encapsulate it by using the Types utility class to
> compose the appropriate type objects:
>   bindWildcardCollectionForSet(binder(),
> ImageSelectionStrategy.class);
> 
> http://google-guice.googlecode.com/svn/tags/2.0/javadoc/com/google/inject/util/Types.html
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
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