Class OpenUnsupportedOperationException
- All Implemented Interfaces:
OpenExceptionMeta, Serializable
UnsupportedOperationException.
不支持的操作异常 — JDK UnsupportedOperationException 的增强替代。
Extends UnsupportedOperationException so it is catchable by
standard JDK idioms (catch(UnsupportedOperationException),
instanceof UnsupportedOperationException, AssertJ
isInstanceOf(UnsupportedOperationException.class)), while also
carrying OpenCode component / error-code metadata via
OpenExceptionMeta.
继承 UnsupportedOperationException,既可被标准 JDK 习惯捕获
(catch、instanceof、AssertJ isInstanceOf),
又通过 OpenExceptionMeta 携带 OpenCode 组件/错误码元数据。
Features | 主要功能:
- Immutable object check (immutable) - 不可变对象检查
- Read-only check (readOnly) - 只读检查
- Not implemented check (notImplemented) - 未实现检查
- Unsupported type check (unsupportedType) - 不支持类型检查
- Generic unsupported (unsupported) - 通用不支持检查
Usage Examples | 使用示例:
@Override
public void unsupportedMethod() {
throw new OpenUnsupportedOperationException("This operation is not supported");
}
// Static factory methods - 静态工厂方法
throw OpenUnsupportedOperationException.immutable();
throw OpenUnsupportedOperationException.readOnly();
throw OpenUnsupportedOperationException.notImplemented("save");
Important | 重要说明:
This exception extends UnsupportedOperationException (not
OpenException); catch(OpenException e) will NOT catch it.
Use OpenExceptionMeta for cross-hierarchy metadata access.
此异常继承 UnsupportedOperationException(而非
OpenException);catch(OpenException e) 无法捕获此异常。
如需跨层级统一访问 metadata,请使用 OpenExceptionMeta。
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是 (不可变)
- Serializable: Yes - 可序列化: 是
- Since:
- JDK 25, opencode-base-core V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOpenUnsupportedOperationException(String message) Creates with the given message.OpenUnsupportedOperationException(String errorCode, String message) Creates with a custom error code.OpenUnsupportedOperationException(String message, Throwable cause) Creates with message and cause. -
Method Summary
Modifier and TypeMethodDescriptionComponent name identifying the logical source of the exception.Stable machine-readable error code.Creates an "immutable object" exception.notImplemented(String methodName) Creates a "not implemented" exception.readOnly()Creates a "read-only" exception.unsupported(String operation) Creates a generic "unsupported operation" exception.unsupportedType(Class<?> type) Creates an "unsupported type" exception.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface OpenExceptionMeta
getMetaPrefix
-
Constructor Details
-
OpenUnsupportedOperationException
Creates with the given message. 创建不支持操作异常。- Parameters:
message- the value | 异常消息
-
OpenUnsupportedOperationException
-
OpenUnsupportedOperationException
-
-
Method Details
-
getErrorCode
Description copied from interface:OpenExceptionMetaStable machine-readable error code. 稳定的机器可读错误码。- Specified by:
getErrorCodein interfaceOpenExceptionMeta- Returns:
- the error code | 错误码
-
getComponent
Description copied from interface:OpenExceptionMetaComponent name identifying the logical source of the exception. 组件名,标识异常的逻辑归属。- Specified by:
getComponentin interfaceOpenExceptionMeta- Returns:
- the component name | 组件名
-
immutable
Creates an "immutable object" exception. 创建"不可变对象"异常。- Returns:
- the result | 异常实例
-
readOnly
Creates a "read-only" exception. 创建"只读"异常。- Returns:
- the result | 异常实例
-
notImplemented
Creates a "not implemented" exception. 创建"未实现"异常。- Parameters:
methodName- the value | 方法名- Returns:
- the result | 异常实例
-
unsupportedType
Creates an "unsupported type" exception. 创建"不支持的类型"异常。- Parameters:
type- the type | 类型- Returns:
- the result | 异常实例
-
unsupported
Creates a generic "unsupported operation" exception. 创建通用"不支持的操作"异常。- Parameters:
operation- the value | 操作名- Returns:
- the result | 异常实例
-