Re: [picocontainer-dev] Thoughts about parameters / simplification of interface
Jörg Schaible <[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 ;) )
You hitch-hike freight trains, do you ? Hehehehe
> 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.
Sounds good. A String component/constant does not make too much sense anyway
and if it does not refer a ConfigParam the behaviour is as before. Fine.
> Thus signature becomes:
> MPC.addComponent(key,compOrInst,Object...)
>
> Of course we shall keep component adapter construction
> with explicit specification of parameters.
>
> WDYT?
Reasonable.
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email