KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > nodes > NodeNotFoundException


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.openide.nodes;
20
21 import java.io.IOException JavaDoc;
22
23
24 /** Exception indicating that a node could not be found while
25 * traversing a path from the root.
26 *
27 * @author Jaroslav Tulach
28 */

29 public final class NodeNotFoundException extends IOException JavaDoc {
30     static final long serialVersionUID = 1493446763320691906L;
31
32     /** closest node */
33     private Node node;
34
35     /** name of child not found */
36     private String JavaDoc name;
37
38     /** depth of not founded node. */
39     private int depth;
40
41     /** Constructor.
42     * @param node closest found node to the one being looked for
43     * @param name name of child not found in that node
44     * @param depth depth of the node that was found
45     */

46     NodeNotFoundException(Node node, String JavaDoc name, int depth) {
47         this.node = node;
48         this.name = name;
49     }
50
51     /** Get the closest node to the target that was able to be found.
52      * @return the closest node
53     */

54     public Node getClosestNode() {
55         return node;
56     }
57
58     /** Get the name of the missing child of the closest node.
59      * @return the name of the missing child
60     */

61     public String JavaDoc getMissingChildName() {
62         return name;
63     }
64
65     /** Getter for the depth of the closest node found.
66     * @return the depth (0 for the start node, 1 for its child, etc.)
67     */

68     public int getClosestNodeDepth() {
69         return depth;
70     }
71 }
72
Popular Tags