Re: [picocontainer-dev] [Paul?] DPC.initForConfig()

Paul Hammant <[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
I see your point Konstantin.

If we were to imagine ConfigAdapter in the style of InstanceAdapter  
for exclusive use by addConfig(..) what what would it do that is  
different ?

All the work is done in BasicComponentParameter.getTargetAdapter(..)  
- it would be there that we change functionality, if we were to  
change it.

Before we change anything though, what would happen in the following  
scenario ..

    public class NeedsString {
        public NeedsString(String foo) { .. }
    }
    dpc.addComponent(NeedsString.class)
    dpc.addComponent(String.class,"is it me you're looking for?");
    dpc.addConfig("foo","is it me you're looking for?");
    dpc.getComponent(NeedsString.class)
    // ?

Regards,

- Paul

On Aug 14, 2007, at 11:45 PM, Konstantin Priblouda wrote:

>
> --- Paul Hammant <[email protected]> wrote:
>
>> You're not convincing me dude :-)
>>
>> Can we talk in terms of end-user code?  show me a
>> code fragment that
>> does something that you do not like.
>>
>> Like this ...
>>
>>    public class NeedsString {
>>      public NeedsString(String foo) { .. }
>>    }
>>    dpc.addComponent(NeedsString.class)
>>    dpc.addConfig("hello","is it me you're looking
>> for?");
>>    dpc.getComponent(NeedsString.class)
>>    // barfs with ambiguous
>
> I would prefer this as unsatisfied.
>
>> Whereas ...
>>
>>    dpc.addComponent(NeedsString.class)
>>    dpc.addComponent(String.class,"is it me you're
>> looking for?");
>>    dpc.getComponent(NeedsString.class)
>>    // works
>
> That's correct.
>
>> Is that the thing that sits uncomfortably with you ?
>
> Yes. It seems that we introduced 3rd kind artifact
> inside container - config entry ( first two were:
> component and instance )  and it is going to stay.
>
> So we need to formally define that most distonct
> property of config entry is:
>  - newer match by type, only by name ( hack with
> ambiguous results from this requirement )
>
> This calls for a new type of component adapter  ;)
>
> regards,
>
>
> ----[ Konstantin Pribluda http://www.pribluda.de ]----------------
> JTec quality components: http://www.pribluda.de/projects/
>
>
>
> ______________________________________________________________________ 
> ______________
> Choose the right car based on your needs.  Check out Yahoo! Autos  
> new Car Finder tool.
> http://autos.yahoo.com/carfinder/
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>


---------------------------------------------------------------------
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.