Revision: 1410
Author: sberlin
Date: Sat Nov 20 20:46:57 2010
Log: Edited wiki page AssistedInject through web user interface.
http://code.google.com/p/google-guice/source/detail?r=1410
Modified:
/wiki/AssistedInject.wiki
=======================================
--- /wiki/AssistedInject.wiki Sat Nov 20 20:44:35 2010
+++ /wiki/AssistedInject.wiki Sat Nov 20 20:46:57 2010
@@ -62,13 +62,13 @@
}
}}}
Then bind a `Provider<Factory>` in the Guice module:
-==!AssistedInject in Guice 2.0==
+====!AssistedInject in Guice 2.0====
{{{
bind(PaymentFactory.class).toProvider(
FactoryProvider.newFactory(PaymentFactory.class, RealPayment.class));
}}}
-==!AssistedInject in Guice 3.0==
+====!AssistedInject in Guice 3.0====
Guice 3.0 improves !AssistedInject by offering the ability to allow
different factory methods to return different types or different
constructors from one type. See the
[http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/assistedinject/FactoryModuleBuilder.html
FactoryModuleBuilder javadoc] for complete details.
{{{
install(new FactoryModuleBuilder()
@@ -76,6 +76,7 @@
.build(PaymentFactory.class));
}}}
+==How & Why==
!AssistedInject maps the `create()` method's parameters to the
corresponding `...@assisted` parameters in the implementation class'
constructor. For the other constructor arguments, it asks the regular
Injector to provide values.
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" 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-dev?hl=en.