Open GoogleCodeExporter opened 9 years ago
hmmmm, I think the fix needs to be more upstream now. It turns out I have an
annotation working just fine where the key is with the generic but it still
seems to wire up the correct implementation via the annotation on the XXX<M>
generic class so I am not sure the best fix here now.
Original comment by dean.hil...@gmail.com
on 27 Oct 2010 at 2:55
ok, so, that seems to be only injecting since it finds the annotation at the
delayed binding time(rather than during b.bind method calls) so that is why
that works as it finds the interface and adds the generic form in the key and
reads the annotation so that is why annotations works with generics but the
b.bind method is not working.
so, maybe just change field.getGenericType to field.getType to fix the issue.
Original comment by dean.hil...@gmail.com
on 27 Oct 2010 at 3:28
You need to give more information on the actual problem you're having. Am I
right in assuming that SimpleEditAddGridFactory is generic like
MockSimpleEditAddGridFactory? I think what you're missing is the use of
TypeLiteral:
bind(new TypeLiteral<SimpleEditAddGriddFactory<EPWFormularyMessage>>(){})
.to(new TypeLiteral<MockSimpleEditAddGridFactory<EPWFormularyMsg>>(){})
.in(Scopes.SINGLETON);
TypeLiteral is how binding generic types is done. Note the {} after each
TypeLiteral, this is necessary. See the FAQ here:
http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions
Original comment by cgdec...@gmail.com
on 27 Oct 2010 at 3:41
sweet, I came back to post maybe the api should be added to instead...but I
guess you have it...this rocks!!
thanks,
Dean
Original comment by dean.hil...@gmail.com
on 27 Oct 2010 at 5:21
Original comment by sberlin
on 27 Oct 2010 at 5:28
Original issue reported on code.google.com by
dean.hil...@gmail.com
on 27 Oct 2010 at 2:42