KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > lang > annotation > IncompleteAnnotationException


1 package java.lang.annotation;
2
3 /**
4  * Thrown to indicate that a program has attempted to access an element of
5  * an annotation type that was added to the annotation type definition after
6  * the annotation was compiled (or serialized). This exception will not be
7  * thrown if the new element has a default value.
8  *
9  * @author Josh Bloch
10  * @since 1.5
11  */

12 public class IncompleteAnnotationException extends RuntimeException JavaDoc {
13     private Class JavaDoc annotationType;
14     private String JavaDoc elementName;
15
16
17     /**
18      * Constructs an IncompleteAnnotationException to indicate that
19      * the named element was missing from the specified annotation type.
20      *
21      * @param annotationType the Class object for the annotation type
22      * @param elementName the name of the missing element
23      */

24     public IncompleteAnnotationException(
25             Class JavaDoc<? extends Annotation JavaDoc> annotationType,
26             String JavaDoc elementName) {
27         super(annotationType.getName() + " missing element " + elementName);
28
29         this.annotationType = annotationType;
30         this.elementName = elementName;
31     }
32
33     /**
34      * Returns the Class object for the annotation type with the
35      * missing element.
36      *
37      * @return the Class object for the annotation type with the
38      * missing element
39      */

40     public Class JavaDoc<? extends Annotation JavaDoc> annotationType() {
41         return annotationType;
42     }
43
44     /**
45      * Returns the name of the missing element.
46      *
47      * @return the name of the missing element
48      */

49     public String JavaDoc elementName() {
50         return elementName;
51     }
52 }
53
Popular Tags