public class InvocationTargetException
extends ReflectiveOperationException
| java.lang.Object | ||||
| java.lang.Throwable | ||||
| java.lang.Exception | ||||
| java.lang.ReflectiveOperationException | ||||
| java.lang.reflect.InvocationTargetException | ||||
InvocationTargetException是一个检查的异常,它包装由调用的方法或构造函数抛出的异常。
从版本1.4开始,此异常已进行了改进,以符合通用异常链接机制。 在施工时提供并通过getTargetException()方法访问的“目标例外”现在被称为原因 ,并且可以通过getCause()方法以及上述“遗留方法”访问。
也可以看看:
Public constructors |
|
|---|---|
InvocationTargetException(Throwable target) 用目标异常构造一个InvocationTargetException。 |
|
InvocationTargetException(Throwable target, String s) 用目标异常和详细消息构造一个InvocationTargetException。 |
|
Protected constructors |
|
|---|---|
InvocationTargetException() 用 |
|
公共方法(Public methods) |
|
|---|---|
Throwable |
getCause() 返回此异常的原因(抛出的目标异常,可能是 |
Throwable |
getTargetException() 获取抛出的目标异常。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Throwable
|
|
java.lang.Object
|
|
InvocationTargetException (Throwable target)
用目标异常构造一个InvocationTargetException。
| 参数(Parameters) | |
|---|---|
target |
Throwable: the target exception |
InvocationTargetException (Throwable target, String s)
用目标异常和详细消息构造一个InvocationTargetException。
| 参数(Parameters) | |
|---|---|
target |
Throwable: the target exception |
s |
String: the detail message |
InvocationTargetException ()
用 null构造一个 InvocationTargetException作为目标异常。
Throwable getCause ()
返回此异常的原因(抛出的目标异常,可能是 null )。
| 返回(Returns) | |
|---|---|
Throwable |
the cause of this exception. |
Throwable getTargetException ()
获取抛出的目标异常。
该方法早于通用异常链接设施。 getCause()方法现在是获取此信息的首选方法。
| 返回(Returns) | |
|---|---|
Throwable |
the thrown target exception (cause of this exception). |