-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
partial injection a.k.a. factory generation #131
Comments
From bslesinsky on July 15, 2007 12:43:51 See also the AssistedInject thread: http://groups.google.com/group/google-guice/browse_thread/thread/9a7e2c57583d21d6 |
From bslesinsky on October 27, 2007 12:48:16 (No comment was entered for this change.) Labels: -Type-Defect Type-Enhancement |
From limpbizkit on June 08, 2008 16:31:42 Deferred past 2.0. We'll stick with assistedinject for that release. Labels: Milestone-Release2.1 |
From limpbizkit on October 27, 2008 11:17:17 Attached Daniel Martin's patch for AssistedInject v2. It's cool feature is support For it to work we need to make sure permgen space doesn't grow uncontrollably when Attachment: gist |
From gili.tzabari on November 28, 2008 00:17:11 Regarding Daniel's patch The Javadoc in the patch needs to be updated. For one, the Jesse, do you plan on trying to commit Daniel's patch for 2.0 and partial injection |
From limpbizkit on November 28, 2008 08:56:40 (No comment was entered for this change.) Labels: -Milestone-Release2.1 Milestone-Release2.0 |
From gili.tzabari on November 28, 2008 10:03:35 I'm curious why FactoryModule.initFactoryProvider() is marked with |
From sberlin on November 30, 2008 19:46:55 Is there any thought to keeping Bean { BeanFactory { It could internally use a UniqueAnnotation to match up parameters that have I ask because it seems like it'd become a bit redundant in many cases to have to (You can ignore this if the idea is to include Daniel's patch only as an |
From gili.tzabari on November 30, 2008 19:59:16 I tend to agree that parameter ordering alone was enough for me in the past. Then Alternatively, you could provide an unsafe "Injector.getInstance(Class clazz, |
From limpbizkit on December 01, 2008 03:17:44
-- I reviewed Daniel's FactoryModule(). It's awesome! But as I'd discussed with Daniel, it doesn't work naturally So I've changed his API to use builders instead. Here's what it looks like: FactoryBuilder has the following API. All methods are optional: I'm happy with the builder but the withModule() and thatMakes() method names could use some lovin'. Status: Started |
From bslesinsky on December 01, 2008 09:46:24 thatMakes() seems good. Can you call it multiple times? If so maybe it should be: It's not obvious what withModule() is supposed to do, or whether you can call it Where is the latest version of the code? |
From limpbizkit on December 01, 2008 13:14:39
I talked to jmourits, the other author of AssistedInject and he observed that in this To accommodate this, I intend to change the behaviour so that all factory parameters |
From sberlin on December 01, 2008 13:32:53 I wholeheartedly agree with the comment that it's hard to differentiate between |
From bslesinsky on December 01, 2008 13:39:50 What will |
From gili.tzabari on December 01, 2008 14:05:38 Why it is important to annotate which parameters come from the user and which from The way I see it, there should be two sets of arguments at any injection point: If you generalize this enough, it should be possible to do away with the CRUD |
From dhanji on December 01, 2008 14:29:46 Yea keeping How about: Or: Just throwing out ideas, the build() seems somewhat out of place in the DSL. |
From limpbizkit on December 01, 2008 22:21:14 r714 contains the first draft of the new implementation. This combines Daniel's code and the old AssistedInject API. It's also been simplified since my last update - the 'withModule()' method has been removed. I figure that Javadoc: http://google-guice.googlecode.com/svn/trunk/latest- javadoc/com/google/inject/assistedinject/Factories.html#create(java.lang.Class,%20java.lang.Class) |
From limpbizkit on December 01, 2008 22:48:18 This can't be closed until the Permgen issue has been addressed -- creating child injectors that use AOP |
From gili.tzabari on December 01, 2008 22:57:31 Jesse, Compare Daniel's API: binder.install(new FactoryModule(PaymentFactory.class)); with the new one: binder.bind(PaymentFactory.class).toInstance(Factories.create(PaymentFactory.class, Can't you avoid repetition as Daniel's API did? |
From limpbizkit on December 02, 2008 00:14:15
The bind() API is very simple. It's explicit that one binding is added and what type the binding is for. You don't I could be persuaded either way on this, but the duplication doesn't offend me. Trying to minimize characters |
From sberlin on December 02, 2008 06:34:16 It's good to see AssistedInjectV2 checked in, but I think the draft that's checked OTOH, it does support all current AssistedInject usecases. I'd like to see the Daniel's API introduced as a way of supporting the things this While AOP is nice, I don't use it internally -- the one features that really stood |
From limpbizkit on December 02, 2008 09:29:11
|
From gili.tzabari on December 02, 2008 09:47:02 Jesse, The error handling in the new code is a bit misleading. It complains: "No implementation for MyFactory was bound. But the real problem was that none of the parameters in the constructedType |
From gili.tzabari on December 02, 2008 10:34:43 Another error: Error injecting method, I tried adding this line to common.xml but it did not help: <keep pattern="net.sf.cglib.reflect.FastClass"/> Any ideas? |
From limpbizkit on December 08, 2008 22:40:21 We've come full circle. The latest r723 implements Dan Martin's new approach using the old API. I'm marking this as closed. If there's backlash about the API unification, that can be considered a separate issue. Status: Fixed |
From bslesinsky on July 07, 2007 21:29:08
(Adding issue for what we talked about already.)
Suppose you have a constructor:
@
InjectFoo(
@
A String a,@
B String b,@
C String c);The caller wants to create a Foo and provide some of these arguments, while
the other ones get injected. We can define a interface for this:
interface FooFactory {
Foo make(
@
A String a);}
Then Guice should be able to automatically create the factory if we ask:
bind(FooFactory.class).generates(Foo.class);
Furthermore, it's not an error if there is no binding for
@
A because Guicenever needs to create it.
Original issue: http://code.google.com/p/google-guice/issues/detail?id=131
The text was updated successfully, but these errors were encountered: