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]>
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].
> 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/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/CAHNex995t_ae%2BKnFpHSxB5vVHLNkP%2BhY%2BdCt5-8VQOpM1BsHqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.