>
> Assuming you meant:
> interface FooFactory {
>   <T> Foo<T> create(T bar);
> }
>

Ah, yes. That's of course what I meant.
 

> This is the closest you can get. I use it pretty frequently:
> interface FooFactory<T> {
>   Foo<T> create(T bar);
> }
>

I'm guessing I would still need to know the generic type, or at least the 
possible types, to bind that in the Module...
 
 
On Tuesday, 26 May 2015 17:08:55 UTC-5, Nate Bauernfeind wrote:
>
> Assuming you meant:
> interface FooFactory {
>   <T> Foo<T> create(T bar);
> }
>
> No, this does not work. It would require one-to-many bindings, which, if 
> you read the recent forum's history, is not supported. 
>
> This is the closest you can get. I use it pretty frequently:
> interface FooFactory<T> {
>   Foo<T> create(T bar);
> }
>
> You will need to use type literals to capture the generic types when you 
> create the assisted inject factories. (See: 
> http://google.github.io/guice/api-docs/latest/javadoc/index.html?com/google/inject/TypeLiteral.html
> )
>
> Nate
>
> On Tue, May 26, 2015 at 5:52 PM Brad Micholson <[email protected] 
> <javascript:>> wrote:
>
>> Is there currently any way to use type inference in an assisted inject 
>> factory?
>> For example, is there any way to use an interface like the following as 
>> an assisted inject factory?
>>
>>
>> interface FooFactory
>> {
>>   Foo<T> create(T bar);
>> }
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "google-guice" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/google-guice.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/google-guice/3b354f12-1927-44fb-ac0d-94b28941ced6%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-guice/3b354f12-1927-44fb-ac0d-94b28941ced6%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/22f7b6a3-4a0a-4511-9531-9273d2b91081%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to