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 java.lang.reflect.Method;
21:
22: import org.apache.harmony.annotation.internal.nls.Messages;
23:
24: /**
25: * <p>
26: * Indicates that an annotation type has changed since it was compiled or
27: * serialized.
28: * </p>
29: *
30: * @since 1.5
31: */
32: public class AnnotationTypeMismatchException extends RuntimeException {
33:
34: private static final long serialVersionUID = 8125925355765570191L;
35:
36: private Method element;
37:
38: private String foundType;
39:
40: /**
41: * <p>
42: * Constructs an instance for the given type element and the type found.
43: * </p>
44: *
45: * @param element The annotation type element.
46: * @param foundType The invalid type that was found.
47: */
48: public AnnotationTypeMismatchException(Method element,
49: String foundType) {
50: super (Messages.getString("annotation.1", element, foundType)); //$NON-NLS-1$
51: this .element = element;
52: this .foundType = foundType;
53: }
54:
55: /**
56: * <p>
57: * The method object for the invalid type.
58: * </p>
59: *
60: * @return A {@link Method} instance.
61: */
62: public Method element() {
63: return element;
64: }
65:
66: /**
67: * <p>
68: * The invalid type.
69: * </p>
70: *
71: * @return A String describing the invalid data.
72: */
73: public String foundType() {
74: return foundType;
75: }
76: }
|