History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: PSL-237
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jens Halm
Reporter: Jens Halm
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Parsley Core

Add configuration tags for observing the lifecycle of other objects

Created: 09/Aug/09 07:56 PM   Updated: 03/Jan/11 04:27 AM
Component/s: Core IOC Container
Affects Version/s: None
Fix Version/s: 2.2.0



 All   Comments   Change History      Sort Order:
Tom Sugden - 11/Aug/09 10:03 AM
This looks very interesting and seems to enable a whole new kind of loosely-coupled relationship between components.

When I first read it, I was a little surprised by the reuse of the PostConstruct and PreDestroy metadata, since the developer now needs to read the metadata and method signature to infer the meaning, since in one case the object is the class instance and in the other it is the parameter. Having said that, I can't think of a better alternative off the top of my head and the rules are easy enough to grasp after a few moments of reflection.

Vincent Spallek - 11/Aug/09 05:58 PM
I had the same reaction - but maybe choosing a different function name than enhance() would help.

Jens Halm - 11/Aug/09 06:43 PM - edited
After some additional discussions with someone who pointed out that it might be vital for an observer to have control whether it is invoked before or after the PostConstruct method in the target instance itself, I probably have to rename the existing tags since I don't want to end up with a tag named PostPostConstruct. ;-)

So probably we'll rather have

[Init]
[Destroy]

for the object itself, and

[PreConfigure]
[PreInit]
[PostInit]
[PreDestroy]
[PostDestroy]

for the observer? You'll then have full control over execution order. I think most of the tag names are self-explanatory. [PreConfigure] would execute even before injections have been performed.

Jens Halm - 25/Oct/09 11:00 PM
Finally I avoided to introduce 5 new tags and went with [Observe] instead, specifying the phase with an attribute.