Hi Stuart,
thanks for the kind and quickly reply! Do you know if they intend to
close that issue before the 3.0 release?
Many thanks in advance,
Simo

http://people.apache.org/~simonetripodi/
http://www.99soft.org/



On Mon, Nov 1, 2010 at 2:03 PM, Stuart McCulloch <[email protected]> wrote:
> On 1 November 2010 12:57, Simone Tripodi <[email protected]> wrote:
>>
>> Hi all guys,
>> does the TypeListener support request injection before the hear()
>> method is executed?
>
> unfortunately, not at the moment:
>   http://code.google.com/p/google-guice/issues/detail?id=409
> you can ask the TypeEncounter for the appropriate Provider,
> but you can't use it until after the injector has been created.
> ( you can however cache the Provider for use later on )
>
>>
>> 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.
>>
>
>
>
> --
> 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.
>

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