KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > element > UnknownElementException


1 /*
2  * @(#)UnknownElementException.java 1.3 06/07/31
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.lang.model.element;
9
10 /**
11  * Indicates that an unknown kind of element was encountered. This
12  * can occur if the language evolves and new kinds of elements are
13  * added to the {@code Element} hierarchy. May be thrown by an
14  * {@linkplain ElementVisitor element visitor} to indicate that the
15  * visitor was created for a prior version of the language.
16  *
17  * @author Joseph D. Darcy
18  * @author Scott Seligman
19  * @author Peter von der Ahé
20  * @version 1.3 06/07/31
21  * @see ElementVisitor#visitUnknown
22  * @since 1.6
23  */

24 public class UnknownElementException extends RuntimeException JavaDoc {
25
26     private static final long serialVersionUID = 269L;
27
28     private transient Element element;
29     private transient Object JavaDoc parameter;
30
31     /**
32      * Creates a new {@code UnknownElementException}. The {@code p}
33      * parameter may be used to pass in an additional argument with
34      * information about the context in which the unknown element was
35      * encountered; for example, the visit methods of {@link
36      * ElementVisitor} may pass in their additional parameter.
37      *
38      * @param e the unknown element, may be {@code null}
39      * @param p an additional parameter, may be {@code null}
40      */

41     public UnknownElementException(Element e, Object JavaDoc p) {
42     super("Unknown element: " + e);
43     element = e;
44     this.parameter = p;
45     }
46
47     /**
48      * Returns the unknown element.
49      * The value may be unavailable if this exception has been
50      * serialized and then read back in.
51      *
52      * @return the unknown element, or {@code null} if unavailable
53      */

54     public Element getUnknownElement() {
55     return element;
56     }
57
58     /**
59      * Returns the additional argument.
60      *
61      * @return the additional argument
62      */

63     public Object JavaDoc getArgument() {
64     return parameter;
65     }
66 }
67
Popular Tags