Community
Participate
Working Groups
The DI engine should support named and annotated injection as well as injection of instances. Allowing both named and annotated injection will allow for greater reuse of annotations and provides greater flexibility. The ability to support injection of instances would be very valuable in a number of different areas.
Created attachment 221108 [details] TypedBinding's ver 0.1
This week I added support to the DI engine for, what I am calling, "TypedBindings." TypedBinding's are very similar to Guice's bindings in that you are able to create a binding with a qualified name and a separate annotation and then bind to either an instance or implementation. An example of a TypedBinding is: InjectorFactory.getDefault().addTypedBinding(String.class) .named(IConstants.NAME).annotatedWith(MyAnnotation.class) .toInstance("My string"); TypedBindings would replace the current Binding framework, and maintains complete backwards compatibility so there are no code changes necessary. The attachment is a patch for the current release of TypedBindings. The code is kept at GitHub: http://github.com/jd-carroll/eclipse.platform.runtime/tree/TypedBindings/bundles/org.eclipse.core.runtime All tests located in bundle o.e.e4.core.tests were successfully run and passed. I will put together additional documentation that describes how to use TypedBinding's in the next few days. I will also create several tests for the newly supported features. JD
GitHub correction: http://github.com/jd-carroll/eclipse.platform.runtime/tree/TypedBindings/bundles/org.eclipse.e4.core.di