[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[e4-dev] DI TypedBinding's Implementation
|
I just released an enhancement for the DI engine that allows for the creation of (what I am calling) typed bindings:
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:
JD