Record Class ValidationError
java.lang.Object
java.lang.Record
cloud.opencode.base.yml.schema.ValidationError
public record ValidationError(String path, String message, ValidationError.ErrorType type)
extends Record
ValidationError - Represents a single validation error in YAML schema validation
ValidationError - 表示 YAML 模式验证中的单个验证错误
An immutable record containing the path where the error occurred, a human-readable message, and the type of error.
一个不可变记录,包含错误发生的路径、人类可读的消息和错误类型。
Features | 主要功能:
- Path-aware error reporting - 路径感知的错误报告
- Typed error categorization - 类型化的错误分类
- Immutable record type - 不可变记录类型
Usage Examples | 使用示例:
ValidationError error = new ValidationError(
"server.port", "Expected Integer but got String", ErrorType.TYPE_MISMATCH
);
System.out.println(error.path()); // "server.port"
System.out.println(error.message()); // "Expected Integer but got String"
System.out.println(error.type()); // TYPE_MISMATCH
Security | 安全性:
- Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
- Since:
- JDK 25, opencode-base-yml V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumError type enumeration for categorizing validation errors. -
Constructor Summary
ConstructorsConstructorDescriptionValidationError(String path, String message, ValidationError.ErrorType type) Creates an instance of aValidationErrorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.message()Returns the value of themessagerecord component.path()Returns the value of thepathrecord component.toString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
ValidationError
Creates an instance of aValidationErrorrecord class.- Parameters:
path- the value for thepathrecord componentmessage- the value for themessagerecord componenttype- the value for thetyperecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-