Hi Kirran, By "callback" do you mean something like a Spring init-method or a JSF @PostConstruct call?
There is no feature in Digester specifically for this, but I guess there are a couple of ways to emulate it. You mention the Digester.setStackAction method. Obviously the onPush method is no use, but why not use onPop? (assuming you have some annotation or implemented interface that tells you which objects to init, and which to ignore). An object on the stack can be "initialised" via either xml attributes or nested child elements. In the second case, there is no generic way to know when an object has been fully initialised until all the nested rules have been executed. So onPop seems an entirely appropriate place to inspect objects for initialisation annotations or interfaces. Simply adding a CallMethodRule to invoke an init method as the first rule after the CreateObjectRule that creates the object will have a very similar effect - CallMethodRules are invoked in reverse order (see the wiki) so the first one registered will be invoked just before the object is popped from the stack. I guess it would be quite nice for SetPropertiesRule to take an init-method parameter, which it invokes after the props are set. For objects that only need xml attributes, that works nicely as the method can be called before child elements are processed. Adding one to ObjectCreateRule, however, is only a very minor convenience. It would need to be called on rule end, making it effectively no different than the manual adding of a CallMethodRule rule. Do you perhaps have a situation where you need objects initialised before they are passed to their parent via a SetNextRule? Then you should see the wiki FAQ: http://wiki.apache.org/jakarta-commons/Digester/FAQ entry: How do I get CallMethodRule to fire before SetNextRule? Regards, Simon ---- kirran <[EMAIL PROTECTED]> schrieb: > > Hi, > these examples really helped me. But I could n't figure out how to get a > callback on each object being populated. Surely i can get a callback by impl > 'onPush'. But the object i get there is a newly created one. I 'd appreciate > if you can let me know of a way to get each object being populated as > against a new obj. > thanks in advance. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
