org.springframework.core

## 类 NestedCheckedException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - org.springframework.core.NestedCheckedException

- 所有已实现的接口:
    Serializable

      public abstract class NestedCheckedException
      extends Exception

  Handy class for wrapping checked `Exceptions` with a root cause.

  This class is `abstract` to force the programmer to extend the class. `getMessage` will include nested exception information; `printStackTrace` and other like methods will delegate to the wrapped exception, if any.

  The similarity between this class and the `NestedRuntimeException` class is unavoidable, as Java forces these two classes to have different superclasses (ah, the inflexibility of concrete inheritance!).

  作者:
    Rod Johnson, Juergen Hoeller
  另请参阅:
    `getMessage()`, `Throwable.printStackTrace()`, `NestedRuntimeException`, 序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `NestedCheckedException(String msg)` Construct a `NestedCheckedException` with the specified detail message.
    `NestedCheckedException(String msg, Throwable cause)` Construct a `NestedCheckedException` with the specified detail message and nested exception.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `boolean` | `contains(Class<?> exType)` Check whether this exception contains an exception of the given type: either it is of the given class itself or it contains a nested cause of the given type.
    `String` | `getMessage()` Return the detail message, including the message from the nested exception if there is one.
    `Throwable` | `getMostSpecificCause()` Retrieve the most specific cause of this exception, that is, either the innermost cause (root cause) or this exception itself.
    `Throwable` | `getRootCause()` Retrieve the innermost cause of this exception, if any.

    - ### 从类继承的方法 java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 构造器详细资料

    - #### NestedCheckedException

          public NestedCheckedException(String msg)

      Construct a `NestedCheckedException` with the specified detail message.
      参数:
        `msg` - the detail message

    - #### NestedCheckedException

          public NestedCheckedException(@Nullable
                                        String msg,
                                        @Nullable
                                        Throwable cause)

      Construct a `NestedCheckedException` with the specified detail message and nested exception.
      参数:
        `msg` - the detail message
        `cause` - the nested exception

  - ### 方法详细资料

    - #### getMessage

          @Nullable
          public String getMessage()

      Return the detail message, including the message from the nested exception if there is one.
      覆盖:
        `getMessage` 在类中 `Throwable`

    - #### getRootCause

          @Nullable
          public Throwable getRootCause()

      Retrieve the innermost cause of this exception, if any.
      返回:
        the innermost exception, or `null` if none

    - #### getMostSpecificCause

          public Throwable getMostSpecificCause()

      Retrieve the most specific cause of this exception, that is, either the innermost cause (root cause) or this exception itself.

      Differs from `getRootCause()` in that it falls back to the present exception if there is no root cause.

      返回:
        the most specific cause (never `null`)
      从以下版本开始:
        2.0.3

    - #### contains

          public boolean contains(@Nullable
                                  Class<?> exType)

      Check whether this exception contains an exception of the given type: either it is of the given class itself or it contains a nested cause of the given type.
      参数:
        `exType` - the exception type to look for
      返回:
        whether there is a nested exception of the specified type