|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ElementPath.java | - | - | - | - |
|
||||||||||||||
| 1 | /* | |
| 2 | * Copyright 2001-2005 (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 | ||
| 8 | package org.dom4j; | |
| 9 | ||
| 10 | /** | |
| 11 | * This interface is used by {@link ElementHandler}instances to retrieve | |
| 12 | * information about the current path hierarchy they are to process. It's | |
| 13 | * primary use is to retrieve the current {@link Element}being processed. | |
| 14 | * | |
| 15 | * @author <a href="mailto:dwhite@equipecom.com">Dave White </a> | |
| 16 | * @version $Revision: 1.6 $ | |
| 17 | */ | |
| 18 | public interface ElementPath { | |
| 19 | /** | |
| 20 | * DOCUMENT ME! | |
| 21 | * | |
| 22 | * @return the number of elements in the path | |
| 23 | */ | |
| 24 | int size(); | |
| 25 | ||
| 26 | /** | |
| 27 | * DOCUMENT ME! | |
| 28 | * | |
| 29 | * @param depth | |
| 30 | * DOCUMENT ME! | |
| 31 | * | |
| 32 | * @return the element at the specified depth index, 0 = root element | |
| 33 | */ | |
| 34 | Element getElement(int depth); | |
| 35 | ||
| 36 | /** | |
| 37 | * DOCUMENT ME! | |
| 38 | * | |
| 39 | * @return the path as a string | |
| 40 | */ | |
| 41 | String getPath(); | |
| 42 | ||
| 43 | /** | |
| 44 | * DOCUMENT ME! | |
| 45 | * | |
| 46 | * @return the current element | |
| 47 | */ | |
| 48 | Element getCurrent(); | |
| 49 | ||
| 50 | /** | |
| 51 | * Adds the <code>ElementHandler</code> to be called when the specified | |
| 52 | * path is encounted. The path can be either an absolute path (i.e. prefixed | |
| 53 | * with "/") or a relative path (i.e. assummed to be a child of the current | |
| 54 | * path as retrieved by <b>getPath </b>. | |
| 55 | * | |
| 56 | * @param path | |
| 57 | * is the path to be handled | |
| 58 | * @param handler | |
| 59 | * is the <code>ElementHandler</code> to be called by the event | |
| 60 | * based processor. | |
| 61 | */ | |
| 62 | void addHandler(String path, ElementHandler handler); | |
| 63 | ||
| 64 | /** | |
| 65 | * Removes the <code>ElementHandler</code> from the event based processor, | |
| 66 | * for the specified path. The path can be either an absolute path (i.e. | |
| 67 | * prefixed with "/") or a relative path (i.e. assummed to be a child of the | |
| 68 | * current path as retrieved by <b>getPath </b>. | |
| 69 | * | |
| 70 | * @param path | |
| 71 | * is the path to remove the <code>ElementHandler</code> for. | |
| 72 | */ | |
| 73 | void removeHandler(String path); | |
| 74 | } | |
| 75 | ||
| 76 | /* | |
| 77 | * Redistribution and use of this software and associated documentation | |
| 78 | * ("Software"), with or without modification, are permitted provided that the | |
| 79 | * following conditions are met: | |
| 80 | * | |
| 81 | * 1. Redistributions of source code must retain copyright statements and | |
| 82 | * notices. Redistributions must also contain a copy of this document. | |
| 83 | * | |
| 84 | * 2. Redistributions in binary form must reproduce the above copyright notice, | |
| 85 | * this list of conditions and the following disclaimer in the documentation | |
| 86 | * and/or other materials provided with the distribution. | |
| 87 | * | |
| 88 | * 3. The name "DOM4J" must not be used to endorse or promote products derived | |
| 89 | * from this Software without prior written permission of MetaStuff, Ltd. For | |
| 90 | * written permission, please contact dom4j-info@metastuff.com. | |
| 91 | * | |
| 92 | * 4. Products derived from this Software may not be called "DOM4J" nor may | |
| 93 | * "DOM4J" appear in their names without prior written permission of MetaStuff, | |
| 94 | * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd. | |
| 95 | * | |
| 96 | * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org | |
| 97 | * | |
| 98 | * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND | |
| 99 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 100 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 101 | * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE | |
| 102 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 103 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 104 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 105 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 106 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 107 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 108 | * POSSIBILITY OF SUCH DAMAGE. | |
| 109 | * | |
| 110 | * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. | |
| 111 | */ |
|
||||||||||