Status: New
Owner: ----
New issue 300 by Rinsvind: Allow getInstance/getProvider by TypeLiteral
http://code.google.com/p/google-guice/issues/detail?id=300
Currently you can
Binder.bind(Key<T>)
Binder.bind(Class<T>)
Binder.bind(TypeLiteral<T>)
However you can only
getInstance/Provider(Key<T>)
getInstance/Provider(Class<T>)
Seems natural to add
T Injector.getInstance(TypeLiteral<T> type)
Provider<T> Injector.getProvider(TypeLiteral<T> type)
I have done so in this 10-liner patch I'm attaching and everything seems to
work fine. I'm also attaching a small demo piece of code that shows how
these methods save me the typing of an additional Key.get() when getting
stuff out of an Injector :)
Attachments:
injector.txt 3.0 KB
GetTypeLiteral.java 1.3 KB
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---