KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > lang > TypeNotPresentException


1 /*
2  * @(#)TypeNotPresentException.java 1.4 04/02/03
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.lang;
9
10 /**
11  * Thrown when an application tries to access a type using a string
12  * representing the type's name, but no definition for the type with
13  * the specified name can be found. This exception differs from
14  * {@link ClassNotFoundException} in that <tt>ClassNotFoundException</tt> is a
15  * checked exception, whereas this exception is unchecked.
16  *
17  * <p>Note that this exception may be used when undefined type variables
18  * are accessed as well as when types (e.g., classes, interfaces or
19  * annotation types) are loaded.
20  *
21  * @author Josh Bloch
22  * @since 1.5
23  */

24 public class TypeNotPresentException extends RuntimeException JavaDoc {
25     private String JavaDoc typeName;
26
27     /**
28      * Constructs a <tt>TypeNotPresentException</tt> for the named type
29      * with the specified cause.
30      *
31      * @param typeName the fully qualified name of the unavailable type
32      * @param cause the exception that was thrown when the system attempted to
33      * load the named type, or <tt>null</tt> if unavailable or inapplicable
34      */

35     public TypeNotPresentException(String JavaDoc typeName, Throwable JavaDoc cause) {
36         super("Type " + typeName + " not present", cause);
37     this.typeName = typeName;
38     }
39
40     /**
41      * Returns the fully qualified name of the unavailable type.
42      *
43      * @return the fully qualified name of the unavailable type
44      */

45     public String JavaDoc typeName() { return typeName;}
46 }
47
Popular Tags