public interface StackAction
Because objects are pushed onto the main object stack when a rule has created a new object, this gives the ability to intercept such operations and perform modifications on created objects.
One use expected for this interface is to store information about the xml line that a particular object was created from. An implementation of this interface can detect whenever an object is pushed onto the digester object stack, call Digester.getDocumentLocator() to get the location within the current xml file, and store this either on the object on the stack (if it supports some user-specific interface for this purpose), or build a map of (object->locationinfo) separately.
It is recommended that objects implementing this interface provide a method to set a "next" action, and invoke it from the callback methods. This allows multiple actions to be "chained" together.
See also Digester.setStackAction.
<T> T onPush(Digester d, String stackName, T o)
T
- whatever type is acceptedd
- is the digester instance.stackName
- is the name of the stack onto which the object has been pushed. Null is passed to indicate the
default stack.o
- is the object that has just been pushed. Calling peek on the specified stack will return
the same object.<T> T onPop(Digester d, String stackName, T o)
T
- whatever type is acceptedd
- is the digester instance.stackName
- is the name of the stack from which the object has been popped. Null is passed to indicate the
default stack.o
- is the object that has just been popped.Copyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.