2009/7/6 Andrés Testi <[email protected]>

>
> I need a thing like a ByKeyProvider:
>
> interface ByKeyProvider<T>{
>
>  T get(Key<T> key);
>
> }
>
> Of course, I know ByKeyProvider does not exists. Is there a feature
> like this?
>

basically it's an issue with Java 5 type erasure - while you have certain
type
information at compile time some of this information is deliberately erased
to
maintain binary compatibility with pre-generic classes:

  http://java.sun.com/docs/books/tutorial/java/generics/erasure.html

however Guice provides a technique (type-literals) that lets you retain this
information, albeit at the expense of creating a few additional sub-classes:

  http://publicobject.com/2008/11/guice-punches-erasure-in-face.html

Jesse's example in the above link should be enough to get you started
( if not then post follow up on this thread ;)

Regards.
>
> - Andrés
> >
>


-- 
Cheers, Stuart

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