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
@ProviderMethod #83
Comments
From dhanji on March 22, 2007 01:09:37 good idea. if it has a single argument can u also provide the "injectee"? |
From tpeierls on March 22, 2007 04:27:06 There's a trade-off between reducing dependency on c.g.i and preserving |
From dhanji on March 22, 2007 08:05:48 Tim, you would annotate those methods as |
From kevinb9n on April 20, 2007 08:43:24 Dhanji, that's a good idea, I think. Some examples: Then you would just need to, in your Module, bindStaticProviderMethods(ThatClass.class); depending on whether the methods are static or not; in the first case it just looks And you can name the methods anything you want and no one cares. Can anyone tear this proposal apart? |
From zorzella on April 20, 2007 09:10:44 We likes it, my preciousssss. |
From mcculls on May 30, 2007 21:04:12 Really like ProviderMethods in trunk - saved me from writing lots of scaffolding :) However did run into problems with generic provider methods, for example: public abstract class FooProvider<T> coz the erased return type of the declared method ends up as java.lang.Object :( Use case: want to 'provide' utility class for people to use which contains a binding So I hacked up a quick patch (see attachment) to handle generic return types which install( ProviderMethods.from( new FooProvider<MyConcreteClass>() {} ) ); This works great for the simple case above, but not for more complex return types Hope this helps! Attachment: gist |
From crazyboblee on September 09, 2007 14:10:51 Sorry about that, mcculls. I just noticed this problem myself while do warning cleaup |
From limpbizkit on June 08, 2008 22:42:35 This needs test coverage before it can be closed. Labels: Milestone-Release2.0 |
From limpbizkit on July 14, 2008 10:25:44 Users have requested that AbstractModule automatically installs itself as a ProviderMethodsModule. |
From limpbizkit on August 02, 2008 12:12:04 Generic types are now supported correctly. I used our new TypeResolver classto do this properly. http://publicobject.com/2008/07/typeresolver-tells-you-what-listget.html The only outstanding question - should AbstractModule automatically install itself as a ProviderMethodsModule? |
From limpbizkit on August 02, 2008 16:02:28 I changed it so that Binder automatically installs provider methods from ALL modules, not just abstract I also added doc to Module describing this change. The only outstanding question - should we continue to support ProviderMethods.from() for non-module Status: Fixed |
From kevinb9n on March 22, 2007 02:55:35
From the mailing list,
Why should we make you implement Provider when you could just annotate
various non-void methods as being provider methods?
We could allow this to be applied to static methods as well.
Will flesh out design for this if we want to go fwd with it.
Original issue: http://code.google.com/p/google-guice/issues/detail?id=83
The text was updated successfully, but these errors were encountered: