Hi Sam, thanks a lot for your reply, I'll try your suggestions as well :) Have anice day, Simo
http://people.apache.org/~simonetripodi/ http://www.99soft.org/ On Mon, Nov 1, 2010 at 2:12 PM, Sam Berlin <[email protected]> wrote: > I'm not positive, but it's unlikely that it would work because > TypeListener.hear sets Guice up for how to perform injections. It wouldn't > make sense to inject things prior to knowing how to inject them. You may be > able to workaround it by constructing your TypeListener with a provider of > what you want. Something like: 'myTypeListener = new > MyTypeListener(binder().getProvider(Foo.class));'. > > sam > > On Mon, Nov 1, 2010 at 8:57 AM, Simone Tripodi <[email protected]> > wrote: >> >> Hi all guys, >> does the TypeListener support request injection before the hear() >> method is executed? I mean, in Guice 2.0 the following code doesn't >> work, any chance to making this working with next release? Thanks in >> advance! >> >> class MyTypeListener implements TypeListener { >> �...@inject Service service; >> >> public void setService(Service service) { >> this.service = service; >> } >> >> public <T> void hear(TypeLiteral<T> typeLiteral, TypeEncounter<T> >> typeEncounter) { >> // something magic that requires this.service >> } >> } >> >> @Override >> protected void configure() { >> MyTypeListener myTypeListener = new TypeListener(); >> binder().requestInjection(myTypeListener); >> bindListener(Matchers.any(), myTypeListener); >> } >> >> http://people.apache.org/~simonetripodi/ >> http://www.99soft.org/ >> >> -- >> 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. >> > > -- > 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. > -- 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.
