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. package java.lang;
  8. /**
  9. * Thrown when an application tries to access a type using a string
  10. * representing the type's name, but no definition for the type with
  11. * the specified name can be found. This exception differs from
  12. * {@link ClassNotFoundException} in that <tt>ClassNotFoundException</tt> is a
  13. * checked exception, whereas this exception is unchecked.
  14. *
  15. * <p>Note that this exception may be used when undefined type variables
  16. * are accessed as well as when types (e.g., classes, interfaces or
  17. * annotation types) are loaded.
  18. *
  19. * @author Josh Bloch
  20. * @since 1.5
  21. */
  22. public class TypeNotPresentException extends RuntimeException {
  23. private String typeName;
  24. /**
  25. * Constructs a <tt>TypeNotPresentException</tt> for the named type
  26. * with the specified cause.
  27. *
  28. * @param typeName the fully qualified name of the unavailable type
  29. * @param cause the exception that was thrown when the system attempted to
  30. * load the named type, or <tt>null</tt> if unavailable or inapplicable
  31. */
  32. public TypeNotPresentException(String typeName, Throwable cause) {
  33. super("Type " + typeName + " not present", cause);
  34. this.typeName = typeName;
  35. }
  36. /**
  37. * Returns the fully qualified name of the unavailable type.
  38. *
  39. * @return the fully qualified name of the unavailable type
  40. */
  41. public String typeName() { return typeName;}
  42. }