Re: [picocontainer-dev] Multi Injection

Jörg Schaible <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
Shawn wrote:

> 
> 
> 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);

This was my proposed solution in http://jira.codehaus.org/browse/PICO-160

;-)

- Jörg



---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.