|
GuiceCompatibility
It looks like Guice, it walks like Guice, so it must be Guice?
Guice CompatibilityAPIWe have alternative types for:
For Module and AbtractModule, use GinModule and AbstractGinModule. They work much like their counterparts, but lack some of the features. Note that there is a 100% one-way conversion from GWT to Guice using GinModuleAdapter, so consider putting shared code in a GinModule. Other than that, you could also copy paste bindings from existing modules (usually they'll work), but of course copy-pasting should be discouraged. For Injector, use the Ginjector conbined with the @GinModules annotation. See the GinTutorial to learn how you can get started and GinFaq for more helpful hints. For everything else, use the Guice types. Note that we do not support everything Guice does (and we never will), so keep in mind when you are developing with GIN. See the feature comparison below for more information. FeaturesHere we compare the current GIN trunk with Guice 1.0 and 2.0. The feature list is not complete, but should give you a rough idea about what works and what doesn't. A = Available N/A = Not Available (will probably never happen) P = Planned (possible) Configuration
Runtime
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
When's the official release? EVERYONE wants to start using this ASAP
Why not support toInstance() by having the runtime code set the instances up after creating the Ginjector. For example:
class MyModule? extends AbstractGinModue? { configure() {
} }interface MyGinjector? extends Ginjector {
}class MyEntryPoint? implements EntryPoint? { onModuleCreate() { MyGinjector? injector = GWT.create(MyGinjector?); injector.setFooInstance(foo); injector.setBarInstance(bar); } }
You'd have to throw an error if an instance was not set before it was injected, but this approach seems quite straightforward to implement to me...
@thebravedave
We've been using it off of trunk for many months now. It works great.
Just a note for those trying to compile the Gin.jar from the trunk. It DOES work, you just have to make sure everything is configured correctly. Im a newbie, and just managed it myself.
Sorry Guys... I don't get it... how singleton scope is supported it? Every time, user refreshes page, a new module is created. Right?
i would like to see toInstance() implemented too.. :( besides that.. congrats for this big tool!
just a thought.. are you planing to implement some way to inject UIBinder into the ui instead of what we are doing right now.. that is create the uibinder interface each time for each widget trough the GWT.create()??
some way to inject that?
Thanks
Note that you can easily replace toInstance bindings with an analogous provider method, i.e:
proteted configure() { bind(Foo.class).toInstance(new Foo());becomes:
@Provides @Singleton Foo provideFoo() { return new Foo(); }I'm assuming Custom Injections are not supported in Gin? http://code.google.com/p/google-guice/wiki/CustomInjections
A note on Guice Compatibility - map class FactoryModuleBuilder? to GinFactoryModuleBuilder?
Is this representative of what's currently in GIN 1.5?
How about ThrowingProvider?? CheckedProvider??