~ubuntu-branches/ubuntu/maverick/libcommons-digester-java/maverick

« back to all changes in this revision

Viewing changes to src/java/org/apache/commons/digester/StackAction.java

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath, Kumar Appaiah, Varun Hiremath
  • Date: 2007-09-20 22:02:53 UTC
  • mfrom: (0.1.3 upstream) (2.1.3 gutsy)
  • Revision ID: james.westby@ubuntu.com-20070920220253-y7hrhgzfb6ha150y
Tags: 1.8-1
[ Kumar Appaiah ]
* debian/control:
  + Add XS-Vcs-{Svn,Browser}.
  + Add Homepage field.
* Add watch file.

[ Varun Hiremath ]
* New upstream release
* debian/control:
  + Add myself and Kumar Appaiah to Uploaders.
  + move cdbs and debhelper to Build-Depends.
  + modify Description.
* debian/compat: switch to 5
* remove links file from debian/
* debian/rules:
  + Use DEB_UPSTREAM_VERSION to install jar
  + Create a versioned symbolic link to the jar.
  + implement get-orig-source
* Add debian/orig-tar.sh to remove CRLF line terminators from upstream files.
* Update debian/watch to call debian/orig-tar.sh

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: StackAction.java 476205 2006-11-17 16:43:10Z dennisl $
 
2
 *
 
3
 * Licensed to the Apache Software Foundation (ASF) under one or more
 
4
 * contributor license agreements.  See the NOTICE file distributed with
 
5
 * this work for additional information regarding copyright ownership.
 
6
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
7
 * (the "License"); you may not use this file except in compliance with
 
8
 * the License.  You may obtain a copy of the License at
 
9
 * 
 
10
 *      http://www.apache.org/licenses/LICENSE-2.0
 
11
 * 
 
12
 * Unless required by applicable law or agreed to in writing, software
 
13
 * distributed under the License is distributed on an "AS IS" BASIS,
 
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
15
 * See the License for the specific language governing permissions and
 
16
 * limitations under the License.
 
17
 */ 
 
18
 
 
19
 
 
20
package org.apache.commons.digester;
 
21
 
 
22
/**
 
23
 * An interface that can be implemented in order to get notifications of
 
24
 * objects being pushed onto a digester stack or popped from one.
 
25
 * <p>
 
26
 * Because objects are pushed onto the main object stack when a rule
 
27
 * has created a new object, this gives the ability to intercept such
 
28
 * operations and perform modifications on created objects.
 
29
 * <p>
 
30
 * One use expected for this interface is to store information about the xml
 
31
 * line that a particular object was created from. An implementation of this
 
32
 * interface can detect whenever an object is pushed onto the digester object
 
33
 * stack, call Digester.getDocumentLocator() to get the location within the
 
34
 * current xml file, and store this either on the object on the stack (if it
 
35
 * supports some user-specific interface for this purpose), or build a map of
 
36
 * (object->locationinfo) separately.
 
37
 * <p>
 
38
 * It is recommended that objects implementing this interface provide
 
39
 * a method to set a "next" action, and invoke it from the callback
 
40
 * methods. This allows multiple actions to be "chained" together.
 
41
 * <p>
 
42
 * See also Digester.setStackAction.
 
43
 * 
 
44
 * @since 1.8
 
45
 */
 
46
public interface StackAction {
 
47
    /**
 
48
     * Invoked just before an object is to be pushed onto a digester stack.
 
49
     * 
 
50
     * @param d is the digester instance.
 
51
     * 
 
52
     * @param stackName is the name of the stack onto which the object
 
53
     * has been pushed. Null is passed to indicate the default stack.
 
54
     * 
 
55
     * @param o is the object that has just been pushed. Calling peek on the
 
56
     * specified stack will return the same object.
 
57
     * 
 
58
     * @return the object to be pushed. Normally, parameter o is returned
 
59
     * but this method could return an alternate object to be pushed
 
60
     * instead (eg a proxy for the provided object).
 
61
     */
 
62
    public Object onPush(Digester d, String stackName, Object o);
 
63
 
 
64
    /**
 
65
     * Invoked just after an object has been popped from a digester stack.
 
66
     * 
 
67
     * @param d is the digester instance.
 
68
     * 
 
69
     * @param stackName is the name of the stack from which the object
 
70
     * has been popped. Null is passed to indicate the default stack.
 
71
     * 
 
72
     * @param o is the object that has just been popped.
 
73
     * 
 
74
     * @return the object to be returned to the called. Normally, parameter
 
75
     * o is returned but this method could return an alternate object.
 
76
     */
 
77
    public Object onPop(Digester d, String stackName, Object o);
 
78
}