That sounds like it could be nifty. It's a bit like the class-based @Singleton, but named. Do you further inject the provided instance?
I assume it overrides any values provided from a supplier (e.g., context)? Brian. On 14-Sep-2012, at 3:39 PM, Joseph D Carroll Jr wrote: > I just released an enhancement for the DI engine that allows for the creation > of (what I am calling) typed bindings: > http://bugs.eclipse.org/bugs/show_bug.cgi?id=389634 > > Here is an example of what you are able to do with typed bindings: > injector.addTypedBinding(String.class).toInstance("My string"); > > injector.addTypedBinding(String.class).named("NAMED").toInstance("Some other > string"); > > injector.addTypedBinding(FooBar.class).annotatedWith(MyAnnotation.class).toInstance(myFooBarImpl); > > injector.addTypedBinding(FooBar.class).named("NAMED").annotatedWith(ExecuteMe.class).toInstance(someOtherFooBarImpl); > > injector.addTypedBinding(FooBar.class).annotatedWith(MyOtherAnnotation.class).named("NAMED").toImplementation(FooBar.class); > injector.addTypedBinding(TestSingleton.class); > > I am certainly open to, and looking for, comments and will continue to make > enhancements and any fixes. In the next few days I will put together a > little better documentation. > This implementation is also 100% backwards compatible with the current > bindings. > > The code is hosted here: > http://github.com/jd-carroll/eclipse.platform.runtime/tree/TypedBindings/bundles/org.eclipse.e4.core.di > > > JD > _______________________________________________ > e4-dev mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/e4-dev
_______________________________________________ e4-dev mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/e4-dev
