KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)UnknownAnnotationValueException.java 1.4 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 annotation value was encountered.
12  * This can occur if the language evolves and new kinds of annotation
13  * values can be stored in an annotation. May be thrown by an
14  * {@linkplain AnnotationValueVisitor annotation value visitor} to
15  * indicate that the visitor was created for a prior version of the
16  * language.
17  *
18  * @author Joseph D. Darcy
19  * @author Scott Seligman
20  * @author Peter von der Ahé
21  * @version 1.4 06/07/31
22  * @see AnnotationValueVisitor#visitUnknown
23  * @since 1.6
24  */

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

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

56     public AnnotationValue getUnknownAnnotationValue() {
57     return av;
58     }
59
60     /**
61      * Returns the additional argument.
62      *
63      * @return the additional argument
64      */

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