01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with this
04: * work for additional information regarding copyright ownership. The ASF
05: * licenses this file to you under the Apache License, Version 2.0 (the
06: * "License"); you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14: * License for the specific language governing permissions and limitations under
15: * the License.
16: */
17:
18: package java.lang.annotation;
19:
20: import org.apache.harmony.annotation.internal.nls.Messages;
21:
22: /**
23: * <p>
24: * Indicates that an element of an annotation type was accessed that was added
25: * after the type was compiled or serialized. This does not apply to new
26: * elements that have default values.
27: * </p>
28: *
29: * @since 1.5
30: */
31: public class IncompleteAnnotationException extends RuntimeException {
32:
33: private static final long serialVersionUID = 8445097402741811912L;
34:
35: private Class<? extends Annotation> annotationType;
36:
37: private String elementName;
38:
39: /**
40: * <p>
41: * Constructs an instance with the incomplete annotation type and the name
42: * of the element that's missing.
43: * </p>
44: *
45: * @param annotationType The annotation type.
46: * @param elementName The name of the incomplete element.
47: */
48: public IncompleteAnnotationException(
49: Class<? extends Annotation> annotationType,
50: String elementName) {
51: super (Messages.getString(
52: "annotation.0", elementName, annotationType.getName())); //$NON-NLS-1$
53: this .annotationType = annotationType;
54: this .elementName = elementName;
55: }
56:
57: /**
58: * <p>
59: * The annotation type.
60: * </p>
61: *
62: * @return A Class instance.
63: */
64: public Class<? extends Annotation> annotationType() {
65: return annotationType;
66: }
67:
68: /**
69: * <p>
70: * The incomplete element's name.
71: * </p>
72: *
73: * @return The name of the element.
74: */
75: public String elementName() {
76: return elementName;
77: }
78: }
|