On 21 Nov 2003, at 09:45, Sylvain Wallez wrote:
> Vadim Gritsenko wrote:
>
>> Sylvain Wallez wrote:
>> ......
>>
>>> So I added a new method to "cocoon" that sets up an object just as
>>> if it were an Avalon component by honoring the various lifecycle
>>> interfaces.
>>>
>>> Some useful lifecycle interfaces to implement are of course
>>> LogEnabled and Serviceable, but also Contextualizable, which gives
>>> access to the object model through the ContextHelper class.
>>>
>>> Example:
>>> var foo = new Foo();
>>> cocoon.setupObject(foo);
>>> foo.doIt("blah");
>>>
>>> This way of setting up object respects IOC, avoids using the very
>>> specific "FOM_Cocoon" class and gently educates people to the good
>>> things provided by Avalon.
>>
>>
>>
>> To make it even more avalonish, this method should instantiate object
>> as well. So it will become:
>>
>> var foo = cocoon.summonObject("com.mycompany.Foo");
>
>
> Good idea. But I'm not sure "summon" is a so common word (I had to
> look in a dictionary). What about the more traditional "createObject"
> or "instanciateObject"?
How about simply
var foo = cocoon.getComponent("com.mycompany.Foo");
and trying to do "role to class lookup" transparently?
--
Stefano.
|