Re: [picocontainer-dev] Thoughts about parameters / simplification of interface
Mauro Talevi <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Konstantin Priblouda wrote:
> Hi all,
>
> Well, now we have 3 types of parameters ( constant ,
> component and config ) - and they are present on
> interface.
>
> Paul points, that it is somehow uncool to pass all the
> "newed" parameters to
> MPC.addComponent(key,compOrInst,params...)
> and there shall be a better way to do this.
>
> It just came to my mind while awaking from morning
> coma
> ( our train drivers are on strike, so I have to
> carpool
> with some really early birds ;) )
> thet we can as well sack those parameters from
> interface, and use just objects instead with following
> logic:
>
> null: resolve by type
> not null:
> try as key
> if exists and type match -> ComponentParameter
> if exists and type is string -> ConfigParameter (
> try to convert)
> if not exists
> if type match treat as constant parameter
> if not and string try to convert (like config
> paramater)
>
> Null parameter array would mean greediest staisfiable,
> empty array - default constructor.
>
> Thus signature becomes:
> MPC.addComponent(key,compOrInst,Object...)
>
> Of course we shall keep component adapter construction
> with explicit specification of parameters.
>
> WDYT?
>
As long as we are simplifying only the facade (and most used) method, it
should be ok.
I'm always a bit nervous about overloading the meaning of the method
params - it makes it shadier and less clear. But in this case it seems
appropriate.
Cheers
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email