Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.digester
Interface StackAction

    public interface StackAction

An interface that can be implemented in order to get notifications of objects being pushed onto a digester stack or popped from one.

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.

Since:
  1.8

Method Summary
`Object` | `onPop(Digester d, String stackName, Object o)` Invoked just after an object has been popped from a digester stack.
`Object` | `onPush(Digester d, String stackName, Object o)` Invoked just before an object is to be pushed onto a digester stack.

Method Detail

### onPush

    Object onPush(Digester d,
                  String stackName,
                  Object o)

  Invoked just before an object is to be pushed onto a digester stack.

  Parameters:
    `d` - 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.
  Returns:
    the object to be pushed. Normally, parameter o is returned but this method could return an alternate object to be pushed instead (eg a proxy for the provided object).

### onPop

    Object onPop(Digester d,
                 String stackName,
                 Object o)

  Invoked just after an object has been popped from a digester stack.

  Parameters:
    `d` - 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.
  Returns:
    the object to be returned to the called. Normally, parameter o is returned but this method could return an alternate object.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.