Hello Bob,

Thanks for the pointers! I have now created 2 ParameterizedType
instances as you've suggested.

My next question is : How do I create a TypeLiteral from those 2
instances now? Or, did you mean them to be used in some other
fashion?

Thanks,

Rahul


On Oct 4, 11:33 am, "Bob Lee" <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 3, 2008 at 2:11 AM, Rahul <[EMAIL PROTECTED]> wrote:
> >  private <T extends CommonUpdatableEntity> Store<T, Query<T>>
> > getStoreInstance(Class<T> entity) {
>
> You need to pass in TypeLiteral<T> instead of Class<T> here.
>
> >    List<Binding<Store<T, Query<T>>>> bindings =
> > injector.findBindingsByType(new TypeLiteral<Store<T, Query<T>>>() {
> >    });
>
> Due to erasure, this is actually looking for Store<T, Query<T>>, not
> Store<Project, Query<Project>>.
>
> If you still want to pass in Class<T>, you could implement ParameterizedType
> yourself in this method. getRawType() would return Store.class.
> getActualTypeArguments() would return Project.class and a second
> ParameterizedType impl to represent Query<Project>.
>
> Bob
--~--~---------~--~----~------------~-------~--~----~
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