后浪云鸿蒙OS教程:鸿蒙OS ReflectiveOperationException

树叶云

ReflectiveOperationException

java.lang.Object

|—java.lang.Throwable

|—|—java.lang.Exception

|—|—|—java.lang.ReflectiveOperationException

public class ReflectiveOperationException
extends Exception

核心反射中反射操作抛出的常见异常超类。

构造函数摘要

构造函数描述
ReflectiveOperationException()构造一个以 null 作为其详细消息的新异常。
ReflectiveOperationException(String message)使用指定的详细消息构造一个新异常。
ReflectiveOperationException(String message, Throwable cause)使用指定的详细消息和原因构造一个新异常。
ReflectiveOperationException(Throwable cause)构造一个具有指定原因的新异常和 (cause==null ? null : cause.toString()) 的详细消息(通常包含原因的类和详细消息)。

方法总结

从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从类 java.lang.Throwable 继承的方法
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

构造函数详细信息

ReflectiveOperationException

public ReflectiveOperationException()

构造一个以 null 作为其详细消息的新异常。 原因未初始化,随后可能通过调用 Throwable.initCause(java.lang.Throwable) 进行初始化。

ReflectiveOperationException

public ReflectiveOperationException(String message)

使用指定的详细消息构造一个新异常。 原因未初始化,随后可能通过调用 Throwable.initCause(java.lang.Throwable) 进行初始化。

参数:

参数名称参数描述
message详细信息。 保存详细消息以供 Throwable.getMessage() 方法稍后检索。

ReflectiveOperationException

public ReflectiveOperationException(String message, Throwable cause)

使用指定的详细消息和原因构造一个新异常。

请注意,与原因相关的详细消息不会自动合并到此异常的详细消息中。

参数:

参数名称参数描述
message详细消息(保存以供 Throwable.getMessage() 方法稍后检索)。
cause原因(由 Throwable.getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。)

ReflectiveOperationException

public ReflectiveOperationException(Throwable cause)

构造一个具有指定原因的新异常和 (cause==null ? null : cause.toString()) 的详细消息(通常包含原因的类和详细消息)。

参数:

参数名称参数描述
cause原因(由 Throwable.getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。)

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/192839.html<

(0)
运维的头像运维
上一篇2025-04-01 18:50
下一篇 2025-04-01 18:51

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注