View Javadoc

1   /*
2    * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
3    * 
4    * This software is open source. 
5    * See the bottom of this file for the licence.
6    * 
7    * $Id: Visitor.java,v 1.5 2004/06/25 12:34:47 maartenc Exp $
8    */
9   
10  package org.dom4j;
11  
12  /*** <p><code>Visitor</code> is used to implement the <code>Visitor</code> 
13    * pattern in DOM4J.
14    * An object of this interface can be passed to a <code>Node</code> which will 
15    * then call its typesafe methods.
16    * Please refer to the <i>Gang of Four</i> book of Design Patterns
17    * for more details on the <code>Visitor</code> pattern.</p>
18    *
19    * <p> This 
20    * <a href="http://rampages.onramp.net/~huston/dp/patterns.html">article</a>
21    * has further discussion on design patterns and links to the GOF book.
22    * This <a href="http://rampages.onramp.net/~huston/dp/visitor.html">link</a>
23    * describes the Visitor pattern in detail.
24    * </p>
25    *
26    * @author <a href="mailto:james.strachan@metastuff.com">James Strachan</a>
27    * @version $Revision: 1.5 $
28    */
29  public interface Visitor {
30  
31      /*** <p>Visits the given <code>Document</code></p>
32        *
33        * @param document is the <code>Document</code> node to visit.
34        */
35      public void visit(Document document);
36  
37      /*** <p>Visits the given <code>DocumentType</code></p>
38        *
39        * @param documentType is the <code>DocumentType</code> node to visit.
40        */
41      public void visit(DocumentType documentType);
42  
43      /*** <p>Visits the given <code>Element</code></p>
44        *
45        * @param node is the <code>Element</code> node to visit.
46        */
47      public void visit(Element node);
48  
49      /*** <p>Visits the given <code>Attribute</code></p>
50        *
51        * @param node is the <code>Attribute</code> node to visit.
52        */
53      public void visit(Attribute node);
54  
55      /*** <p>Visits the given <code>CDATA</code></p>
56        *
57        * @param node is the <code>CDATA</code> node to visit.
58        */
59      public void visit(CDATA node);
60  
61      /*** <p>Visits the given <code>Comment</code></p>
62        *
63        * @param node is the <code>Comment</code> node to visit.
64        */
65      public void visit(Comment node);
66  
67      /*** <p>Visits the given <code>Entity</code></p>
68        *
69        * @param node is the <code>Entity</code> node to visit.
70        */
71      public void visit(Entity node);
72  
73      /*** <p>Visits the given <code>Namespace</code></p>
74        *
75        * @param namespace is the <code>Namespace</code> node to visit.
76        */
77      public void visit(Namespace namespace);
78  
79      /*** <p>Visits the given <code>ProcessingInstruction</code>
80       * </p>
81       *
82       * @param node is the <code>ProcessingInstruction</code> node to visit.
83       */
84      public void visit(ProcessingInstruction node);
85  
86      /*** <p>Visits the given <code>Text</code>
87       * </p>
88       *
89       * @param node is the <code>Text</code> node to visit.
90       */
91      public void visit(Text node);
92  
93  }
94  
95  
96  
97  
98  /*
99   * Redistribution and use of this software and associated documentation
100  * ("Software"), with or without modification, are permitted provided
101  * that the following conditions are met:
102  *
103  * 1. Redistributions of source code must retain copyright
104  *    statements and notices.  Redistributions must also contain a
105  *    copy of this document.
106  *
107  * 2. Redistributions in binary form must reproduce the
108  *    above copyright notice, this list of conditions and the
109  *    following disclaimer in the documentation and/or other
110  *    materials provided with the distribution.
111  *
112  * 3. The name "DOM4J" must not be used to endorse or promote
113  *    products derived from this Software without prior written
114  *    permission of MetaStuff, Ltd.  For written permission,
115  *    please contact dom4j-info@metastuff.com.
116  *
117  * 4. Products derived from this Software may not be called "DOM4J"
118  *    nor may "DOM4J" appear in their names without prior written
119  *    permission of MetaStuff, Ltd. DOM4J is a registered
120  *    trademark of MetaStuff, Ltd.
121  *
122  * 5. Due credit should be given to the DOM4J Project - 
123  *    http://www.dom4j.org
124  *
125  * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
126  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
127  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
128  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
129  * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
130  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
131  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
132  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
133  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
134  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
135  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
136  * OF THE POSSIBILITY OF SUCH DAMAGE.
137  *
138  * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
139  *
140  * $Id: Visitor.java,v 1.5 2004/06/25 12:34:47 maartenc Exp $
141  */