Thanks for your suggestion - I have discovered the provides methods
(annotated with @Provides) that do the same thing.
So for all you out there - just use that annotation - will save a lot of
work and the code gets a lot clearer.


Btw: Guice is great
Btw2: Plz upload to maven central


Regards,

Johannes

je...@swank.ca wrote:
> 
> 
> On Jun 6, 8:48 am, Johannes Schneider <maili...@cedarsoft.com> wrote:
>>         bind( ( TypeLiteral<List<? extends B>> ) TypeLiteral.get(
>> Types.listOf( Types.subtypeOf( new TypeLiteral<B<?>>() {
>>         }.getType() ) ) ) ).toProvider( BProvider.class );
> 
> Not much I can really say - creating models for complex types code-
> intensive. TypeLiteral works for some wildcards, and for the ones it
> doesn't you can either use the Types factory class, or you can do
> something reflective.
>   private final List<? extends B<?> unused = null;
>   private final TypeLiteral<List<? extends B<?>> type = fieldToType
> (MyClass.class, unused);
> 
>   private static Type fieldToType(Class<?> definedIn, String name) {
>     return definedIn.getDeclaredField(name).getGenericType();
>   }
> > 

--~--~---------~--~----~------------~-------~--~----~
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