yukihane / google-gin

Automatically exported from code.google.com/p/google-gin
Apache License 2.0
0 stars 0 forks source link

Add support for assisted inject #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Add support for assisted inject. Proposed solution: Add a method "void
asFactory()" (or similar) to GinLinkedBindingBuilder.  A binding would look
like this:

bind(MyFactory.class).asFactory();
// or
bind(MyFactory.class).annotatedWith(MyAnnotation.class).asFactory();

Internally gin would then fill out the factory implementation.
This could also be added back to Guice's EDSL for native assisted inject
support.

Original issue reported on code.google.com by aragos on 23 Dec 2008 at 8:04

GoogleCodeExporter commented 8 years ago
I would prefer toFactory(). I think Guice is also adding toConstructor() in 
Guice
2.0, so that would be more consistent.
http://code.google.com/p/google-guice/issues/detail?id=231

Original comment by robbie.v...@gmail.com on 23 Dec 2008 at 8:14

GoogleCodeExporter commented 8 years ago
Currently waiting for Guice issue
http://code.google.com/p/google-guice/issues/detail?id=131 to be resolved, will
proceed with this when they have made up their mind.

Original comment by aragos on 31 Dec 2008 at 9:23

GoogleCodeExporter commented 8 years ago

Original comment by aragos on 31 Dec 2008 at 9:23

GoogleCodeExporter commented 8 years ago
Guice issue 131 has been resolved. Our implementation permits the standard 
@Inject annotation on the 
constructor. It uses a one-time-use child injector to create the object.

Original comment by limpbizkit on 31 Dec 2008 at 11:34

GoogleCodeExporter commented 8 years ago
Ok, I must have overlooked that last message.  The resolution doesn't solve my
problem here though:  Was there any later agreement on the API changes?  I'd 
like to
keep our EDSL in sync with Guice's.

The other question that I have is about the structure of the factories:  Guice's
implementation currently enforces one-to-one mappings for factory<->injectee, 
plus
one-to-one mappings for constructors<->factory methods, if I understand the code
correctly.  Will that stay this way or are there any plans to allow those 
features? 
I'd really like to see at least the one-to-many mapping for factories and 
injectees
and am not entirely clear on what the issues are that prevent it.

Original comment by aragos on 1 Jan 2009 at 11:32

GoogleCodeExporter commented 8 years ago
The current allows each factory to produce only one type. It uses the standard 
@Inject annotation on the 
constructor. One tricky detail is that our implementation uses child injectors 
— we do this to support AOP, but it 
also allows injecting providers for the parameters, and injecting parameters 
indirectly.

Original comment by limpbizkit on 2 Jan 2009 at 2:38

GoogleCodeExporter commented 8 years ago
The main problem currently blocking this issue is that Guice doesn't support
assistedInject in its EDSL or SPI.  I can work around that, but things would be 
a lot
cleaner and consistent if we could just use assistedInject as a Guice feature.

Original comment by aragos on 26 Jan 2009 at 4:43

GoogleCodeExporter commented 8 years ago
Any progress with this issue?

Original comment by goran.st...@gmail.com on 15 Jun 2009 at 11:29

GoogleCodeExporter commented 8 years ago
Yes, I have submitted a change to Guice Assisted for review that would (a) 
extend the
capabilities of Assisted Inject and (b) make integration into Gin much easier. 
That
change still needs an ok from the Guice guys though.

See also: http://code.google.com/p/google-guice/issues/detail?id=346 and
http://codereview.appspot.com/25084

Original comment by aragos on 15 Jun 2009 at 2:56

GoogleCodeExporter commented 8 years ago
Guice seems to be sticking with assistedinject for now.

Can GIN use that too?

Original comment by f...@google.com on 19 Jun 2009 at 2:29

GoogleCodeExporter commented 8 years ago
Gin cannot use the current assisted inject or easily offer anything similar. 
The new
proposed API for Assisted Inject would be easier support, even though it is 
never
integrated with Guice.

Original comment by aragos on 25 Jun 2009 at 10:57

GoogleCodeExporter commented 8 years ago
Any news in this issue?

Original comment by terciofi...@gmail.com on 18 Aug 2009 at 10:17

GoogleCodeExporter commented 8 years ago
The new assisted inject version is going to be released soon (this month) and 
then I
can finally look into porting it to Gin. No estimates on when that's finished 
though.

Original comment by aragos on 19 Aug 2009 at 12:16

GoogleCodeExporter commented 8 years ago

Original comment by aragos on 1 Dec 2009 at 1:49

GoogleCodeExporter commented 8 years ago
Is there any news about this issue?

Original comment by miguelan...@gmail.com on 29 Jan 2010 at 6:05

GoogleCodeExporter commented 8 years ago
Issue 68 is no more an issue.

Original comment by terciofi...@gmail.com on 7 Mar 2010 at 7:48

GoogleCodeExporter commented 8 years ago
I'm working on this but it will take a bit since I'm pretty busy with my regular
work. I'll let you know once I have a patch ready that needs reviewing.

Original comment by aragos on 8 Mar 2010 at 8:19

GoogleCodeExporter commented 8 years ago
After a ridiculously long time this patch is finally finished and ready for 
review!
Please take a look here, leave your comments and let me know what you think:
http://codereview.appspot.com/974041

Once the review has finished, I'll submit the patch.

Original comment by aragos on 22 Apr 2010 at 2:03

GoogleCodeExporter commented 8 years ago
Excellent! I'm looking forward to using this in gwt-platform!

Original comment by philippe.beaudoin on 22 Apr 2010 at 3:42

GoogleCodeExporter commented 8 years ago
haii

Original comment by kasthuri...@gmail.com on 27 Apr 2010 at 12:57

GoogleCodeExporter commented 8 years ago
Committed in r138. :)

Original comment by aragos on 17 May 2010 at 5:34

GoogleCodeExporter commented 8 years ago
Hello,

I was wondering How I'm suppose to use this. Do I checkout and build latest 
Guice / 
Gin / AssistedInject?

Thanks, Jee.

Original comment by Jeeyou...@gmail.com on 21 May 2010 at 1:14

GoogleCodeExporter commented 8 years ago
Yep, pretty much. I'll release a new version of Gin once Guice 2.1 has been 
released
(no idea when that'll happen).

Original comment by aragos on 21 May 2010 at 2:51