Class YmlBindException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
cloud.opencode.base.core.exception.OpenException
cloud.opencode.base.yml.exception.OpenYmlException
cloud.opencode.base.yml.exception.YmlBindException
- All Implemented Interfaces:
Serializable
YAML Bind Exception - Thrown when configuration binding fails
YAML 绑定异常 - 当配置绑定失败时抛出
This exception is thrown when YAML content cannot be bound to a Java object.
当 YAML 内容无法绑定到 Java 对象时抛出此异常。
Features | 主要功能:
- Tracks property path and target type for diagnostic info - 跟踪属性路径和目标类型以提供诊断信息
- Supports required field validation errors - 支持必填字段验证错误
- Error code YML_BIND_001 - 错误码 YML_BIND_001
Usage Examples | 使用示例:
try {
YmlBinder.bind(document, ServerConfig.class);
} catch (YmlBindException e) {
System.err.println("Path: " + e.getPath());
System.err.println("Type: " + e.getTargetType());
}
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构建后不可变)
- Null-safe: Yes (path and targetType may be null) - 空值安全: 是(路径和目标类型可为空)
- Since:
- JDK 25, opencode-base-yml V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionYmlBindException(String message) Constructs a bind exception with message.YmlBindException(String path, Class<?> targetType) Constructs a bind exception for required field.YmlBindException(String path, Class<?> targetType, Throwable cause) Constructs a bind exception with path, target type and cause.YmlBindException(String message, Throwable cause) Constructs a bind exception with message and cause. -
Method Summary
Methods inherited from class OpenYmlException
getColumn, getLine, hasLocationMethods inherited from class OpenException
getComponent, getErrorCode, getMessage, getRawMessageMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
YmlBindException
Constructs a bind exception with message. 构造带消息的绑定异常。- Parameters:
message- the detail message | 详细消息
-
YmlBindException
-
YmlBindException
-
YmlBindException
-
-
Method Details
-
getPath
Gets the property path that failed to bind. 获取绑定失败的属性路径。- Returns:
- the property path | 属性路径
-
getTargetType
Gets the target type for binding. 获取绑定的目标类型。- Returns:
- the target type | 目标类型
-