jaroslav@1649
|
1 |
/*
|
jaroslav@1649
|
2 |
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
|
jaroslav@1649
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
jaroslav@1649
|
4 |
*
|
jaroslav@1649
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
jaroslav@1649
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
jaroslav@1649
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
jaroslav@1649
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
jaroslav@1649
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
jaroslav@1649
|
10 |
*
|
jaroslav@1649
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
jaroslav@1649
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
jaroslav@1649
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
jaroslav@1649
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
jaroslav@1649
|
15 |
* accompanied this code).
|
jaroslav@1649
|
16 |
*
|
jaroslav@1649
|
17 |
* You should have received a copy of the GNU General Public License version
|
jaroslav@1649
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
jaroslav@1649
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
jaroslav@1649
|
20 |
*
|
jaroslav@1649
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
jaroslav@1649
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
jaroslav@1649
|
23 |
* questions.
|
jaroslav@1649
|
24 |
*/
|
jaroslav@1649
|
25 |
|
jaroslav@1649
|
26 |
package java.lang;
|
jaroslav@1649
|
27 |
|
jaroslav@1649
|
28 |
/**
|
jaroslav@1649
|
29 |
* Thrown when an application tries to access a type using a string
|
jaroslav@1649
|
30 |
* representing the type's name, but no definition for the type with
|
jaroslav@1649
|
31 |
* the specified name can be found. This exception differs from
|
jaroslav@1649
|
32 |
* {@link ClassNotFoundException} in that <tt>ClassNotFoundException</tt> is a
|
jaroslav@1649
|
33 |
* checked exception, whereas this exception is unchecked.
|
jaroslav@1649
|
34 |
*
|
jaroslav@1649
|
35 |
* <p>Note that this exception may be used when undefined type variables
|
jaroslav@1649
|
36 |
* are accessed as well as when types (e.g., classes, interfaces or
|
jaroslav@1649
|
37 |
* annotation types) are loaded.
|
jaroslav@1649
|
38 |
* In particular, this exception can be thrown by the {@linkplain
|
jaroslav@1649
|
39 |
* java.lang.reflect.AnnotatedElement API used to read annotations
|
jaroslav@1649
|
40 |
* reflectively}.
|
jaroslav@1649
|
41 |
*
|
jaroslav@1649
|
42 |
* @author Josh Bloch
|
jaroslav@1649
|
43 |
* @see java.lang.reflect.AnnotatedElement
|
jaroslav@1649
|
44 |
* @since 1.5
|
jaroslav@1649
|
45 |
*/
|
jaroslav@1649
|
46 |
public class TypeNotPresentException extends RuntimeException {
|
jaroslav@1649
|
47 |
private static final long serialVersionUID = -5101214195716534496L;
|
jaroslav@1649
|
48 |
|
jaroslav@1649
|
49 |
private String typeName;
|
jaroslav@1649
|
50 |
|
jaroslav@1649
|
51 |
/**
|
jaroslav@1649
|
52 |
* Constructs a <tt>TypeNotPresentException</tt> for the named type
|
jaroslav@1649
|
53 |
* with the specified cause.
|
jaroslav@1649
|
54 |
*
|
jaroslav@1649
|
55 |
* @param typeName the fully qualified name of the unavailable type
|
jaroslav@1649
|
56 |
* @param cause the exception that was thrown when the system attempted to
|
jaroslav@1649
|
57 |
* load the named type, or <tt>null</tt> if unavailable or inapplicable
|
jaroslav@1649
|
58 |
*/
|
jaroslav@1649
|
59 |
public TypeNotPresentException(String typeName, Throwable cause) {
|
jaroslav@1649
|
60 |
super("Type " + typeName + " not present", cause);
|
jaroslav@1649
|
61 |
this.typeName = typeName;
|
jaroslav@1649
|
62 |
}
|
jaroslav@1649
|
63 |
|
jaroslav@1649
|
64 |
/**
|
jaroslav@1649
|
65 |
* Returns the fully qualified name of the unavailable type.
|
jaroslav@1649
|
66 |
*
|
jaroslav@1649
|
67 |
* @return the fully qualified name of the unavailable type
|
jaroslav@1649
|
68 |
*/
|
jaroslav@1649
|
69 |
public String typeName() { return typeName;}
|
jaroslav@1649
|
70 |
}
|