Martin Fuzzey
2008-06-18 15:54:51 UTC
Hi,
I would like to be able to execute arbitary code using objects created
by picocontainer after DI has been performed.
The code is not in the objects themselves (so lifecycle methods wont't do)
I would like to do this based on object type / key.
For example suppose I have fruit classes (Apple, Pear, ...) and animal
classes (Cow, Tiger, ...) managed by picocontainer.
When an animal is created by pico and after its dependencies have been
resolved I would like to call a method on my Zoo class passing the
animal as a parameter.
However I don't want to pass fruits to my zoo.
This seems a bit like behaviours except for the class specific thing.
[ of course I could create a behaviour and test the object type but
that doesn't seem right! ]
I think I could do this using addAdapter() rather than addComponent()
but that would mean I would have to duplicate some of the code in
addComponent().
Ideas appreciated,
Martin
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
I would like to be able to execute arbitary code using objects created
by picocontainer after DI has been performed.
The code is not in the objects themselves (so lifecycle methods wont't do)
I would like to do this based on object type / key.
For example suppose I have fruit classes (Apple, Pear, ...) and animal
classes (Cow, Tiger, ...) managed by picocontainer.
When an animal is created by pico and after its dependencies have been
resolved I would like to call a method on my Zoo class passing the
animal as a parameter.
However I don't want to pass fruits to my zoo.
This seems a bit like behaviours except for the class specific thing.
[ of course I could create a behaviour and test the object type but
that doesn't seem right! ]
I think I could do this using addAdapter() rather than addComponent()
but that would mean I would have to duplicate some of the code in
addComponent().
Ideas appreciated,
Martin
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email