I forgot some parenthesis:

bind(new TypeLiteral<Class<? extends
SomeClass>>(){}).toInstance(SomeSubClass.class.getClass());

On Fri, Jan 21, 2011 at 11:42 AM, Philippe Beaudoin
<[email protected]> wrote:
> Assuming you want to do something like that:
>
> @Inject Class<? extends SomeClass> theClass;
>
> And you want it injected with Class<SomeSubClass>, where SomeSubClass
> extends SomeClass, then you can do:
>
> bind(new TypeLiteral<Class<? extends
> SomeClass>>{}).toInstance(SomeSubClass.class.getClass());
>
> Cheers,
>
>   Philippe
>
>
> On Fri, Jan 21, 2011 at 10:26 AM, Sam Berlin <[email protected]> wrote:
>> Could you elaborate on what you're trying to achieve?  I'm not sure what
>> you're asking.
>> sam
>>
>> On Mon, Jan 10, 2011 at 7:26 AM, Magno Machado <[email protected]> wrote:
>>>
>>> Is it possible to Guice to inject a class type (a java.lang.Class, not
>>> an object instance)?
>>>
>>> I'm using Guice 3.0RC
>>>
>>> --
>>> 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.

Reply via email to