KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > type > UnknownTypeException


1 /*
2  * @(#)UnknownTypeException.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.type;
9
10 /**
11  * Indicates that an unknown kind of type was encountered. This can
12  * occur if the language evolves and new kinds of types are added to
13  * the {@code TypeMirror} hierarchy. May be thrown by a {@linkplain
14  * TypeVisitor type visitor} to indicate that the visitor was created
15  * 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 TypeVisitor#visitUnknown
22  * @since 1.6
23  */

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

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

54     public TypeMirror getUnknownType() {
55     return type;
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