Re: [picocontainer-dev] Multi Injection
Shawn <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Jörg Schaible-2 wrote:
>
>
> Why not create a DefaultConstructorFactory (implementing InjectionFactory)
> that requires a component to have a default ctor with no args? You could
> implmenet SI as Behaviour and the DCF for pure SI ... or combine it with
> CI. The problem is, how do you know which deps you really need, which ones
> are consumed by CI and which ones are optional for SI.
>
Currently, my solution is to add more hints in the parameter.
For example, introduce NamedParameter class with a boolean field indicates
whether this dependency is mandatory or not.
Parameter p = new NamedParameter("fieldName",new
Parameter("comKey"),true/*is mandatory or not ?*/ );
CA ca = new SetterInjectionCA(new CDICA(foo.class),new Parameter[]{p}); //
Note, SetterInjectionCA is fully rewritten here that will accept the
Parameter[] array as SDI hints.
p.registerComponent(CA);
--
View this message in context: http://www.nabble.com/Multi-Injection-tf4286388.html#a12214221
Sent from the NanoContainer - PicoContainer - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email