I tried to reproduce your error, but i couldn't.

The problem is:

You have a generic interface, but you are binding only its raw type...

Suppose you want to receive a List<Something> as dependency...
this way you must do something like:

 bind(new TypeLiteral<List<Something>>() {}).toInstance(new
ArrayList<Something>());

http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions#How_to_inject_class_with_generic_type?<http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions>

On Thu, Sep 23, 2010 at 5:09 PM, Christian Goudreau <
[email protected]> wrote:

> This one:
> bind(MemberView.MyUiHandlers.class).to(MemberPresenter.class);
>
> How can I bind H ? And I will have to remove the upper one if I don't want
> to get and error from Guive.
>
> Thanks btw for every input I had
>
> 2010/9/23 Yaxin Liu 刘亚新 <[email protected]>
>
>> TypeLiteral?
>>
>>
>> On Thu, Sep 23, 2010 at 7:50 AM, Christian Goudreau <
>> [email protected]> wrote:
>>
>>> Yeah, well, that doesn't work :D It's still complaining about H extends
>>> UiHandlers that isn't bind :D (H = MyUiHandlers and is bound)
>>>
>>> Cheers,
>>>
>>>
>>> On Thu, Sep 23, 2010 at 10:47 AM, Lucas Cavalcanti <
>>> [email protected]> wrote:
>>>
>>>> When your class has a generic type, I think you have to do the generic
>>>> binding explicity:
>>>>
>>>> bind(new
>>>> TypeLiteral<UiHandlersStrategy<MyUiHandlers>>(){}).annotatedWith(...).to(...);
>>>>
>>>> You could try to use wildcards, but I'm not sure if it works
>>>>
>>>> []'s
>>>> Lucas
>>>>
>>>>
>>>> On Thu, Sep 23, 2010 at 11:35 AM, Christian Goudreau <
>>>> [email protected]> wrote:
>>>>
>>>>> Anyone else ?
>>>>>
>>>>>
>>>>> On Wed, Sep 22, 2010 at 11:34 AM, Christian Goudreau <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> bind(MemberView.MyUiHandlers.class).to(MemberPresenter.class);
>>>>>>
>>>>>>     bind(UiHandlersStrategy.class).annotatedWith(ProviderUiHandler.
>>>>>> class).to(ProviderUiHandlersStrategyImpl.class);
>>>>>>
>>>>>>     bind(UiHandlersStrategy.class).annotatedWith(SetterUiHandler.
>>>>>> class).to(SetterUiHandlersStrategyImpl.class);
>>>>>>
>>>>>> public interface UiHandlersStrategy<H extends UiHandlers> {
>>>>>>
>>>>>>   void setUiHandlers(H uiHandlers);
>>>>>>
>>>>>>   H getUiHandlers();
>>>>>>
>>>>>> }
>>>>>>
>>>>>> public class ProviderUiHandlersStrategyImpl<H extends UiHandlers>
>>>>>> implements
>>>>>>
>>>>>>     UiHandlersStrategy<H> {
>>>>>>
>>>>>>   private final Provider<H> uiHandlersProvider;
>>>>>>
>>>>>>
>>>>>> Here's more informations. What I don't get is that MyUiHandlers is
>>>>>> declared... but my guest is that it is AFTER the other one...
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>>
>>>>>> On Wed, Sep 22, 2010 at 11:16 AM, Fred Faber <[email protected]>wrote:
>>>>>>
>>>>>>> Can you post your binding?
>>>>>>>
>>>>>>> You should be able to do this with something to the effect of:
>>>>>>>
>>>>>>> bind(new TypeLiteral<UiHandlersStrategy<MyUiHandlers>(){})
>>>>>>>   .to(...your impl);
>>>>>>>
>>>>>>> -Fred
>>>>>>>
>>>>>>> On Mon, Sep 20, 2010 at 5:10 PM, Christian Goudreau <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Humm I think my subject is weird... anyway :D
>>>>>>>>
>>>>>>>> Here's what I want to do:
>>>>>>>>
>>>>>>>>   @Inject
>>>>>>>>
>>>>>>>>   public MemberView(@ProviderUiHandler 
>>>>>>>> finalUiHandlersStrategy<MyUiHandlers> providerUiHandlersStrategyImpl) {
>>>>>>>> My error:
>>>>>>>> 17:02:42.928 [ERROR] [apapul] No implementation bound for key
>>>>>>>> Key[type=ca.ulaval.apapul.client.mvp.strategies.uihandlers.UiHandlersStrategy<ca.ulaval.apapul.client.core.member.MemberView$MyUiHandlers>,
>>>>>>>> [email protected]]
>>>>>>>>
>>>>>>>> MyUiHandlers is also an interface binded by Gin/Guice. Using the
>>>>>>>> implementation class instead the interface work, but I wanted to use 
>>>>>>>> the
>>>>>>>> interface with an annotation.
>>>>>>>>
>>>>>>>> Btw, is this worth the pain ? That seem to be almost as if I was
>>>>>>>> using the implementation class anyway...
>>>>>>>>
>>>>>>>> Thanks and cheers,
>>>>>>>>
>>>>>>>> --
>>>>>>>> Christian Goudreau
>>>>>>>> www.arcbees.com
>>>>>>>>
>>>>>>>>  --
>>>>>>>> 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]<google-guice%[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]<google-guice%[email protected]>
>>>>>>> .
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/google-guice?hl=en.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Christian Goudreau
>>>>>> www.arcbees.com
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Christian Goudreau
>>>>> www.arcbees.com
>>>>>
>>>>>  --
>>>>> 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]<google-guice%[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]<google-guice%[email protected]>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-guice?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> Christian Goudreau
>>> www.arcbees.com
>>>
>>>  --
>>> 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]<google-guice%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-guice?hl=en.
>>>
>>
>>
>>
>> --
>> Yaxin
>>
>>  --
>> 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]<google-guice%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-guice?hl=en.
>>
>
>
>
> --
> Christian Goudreau
> www.arcbees.com
>
>  --
> 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]<google-guice%[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