Class ValidationResult
java.lang.Object
cloud.opencode.base.graph.validation.ValidationResult
Validation Result
验证结果
Represents the result of graph validation.
表示图验证的结果。
Features | 特性:
- Collects warnings and errors | 收集警告和错误
- Provides validation status | 提供验证状态
- Immutable result structure | 不可变的结果结构
Usage Examples | 使用示例:
ValidationResult result = GraphValidator.validateGraph(graph);
if (result.hasErrors()) {
result.errors().forEach(System.err::println);
}
if (result.hasWarnings()) {
result.warnings().forEach(System.out::println);
}
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Null-safe: Yes (stores unmodifiable lists) - 空值安全: 是(存储不可修改的列表)
- Since:
- JDK 25, opencode-base-graph V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for ValidationResult ValidationResult构建器 -
Constructor Summary
ConstructorsConstructorDescriptionValidationResult(List<String> warnings, List<String> errors) Create a validation result 创建验证结果 -
Method Summary
Modifier and TypeMethodDescriptionstatic ValidationResultCreate a validation result with a single error 创建带单个错误的验证结果intGet the count of errors 获取错误数量errors()Get the list of errors 获取错误列表booleanCheck if there are errors 检查是否有错误booleanCheck if there are warnings 检查是否有警告booleanisValid()Check if validation passed (no errors) 检查验证是否通过(无错误)merge(ValidationResult other) Merge with another validation result 与另一个验证结果合并static ValidationResultsuccess()Create a successful validation result 创建成功的验证结果toString()static ValidationResultCreate a validation result with a single warning 创建带单个警告的验证结果intGet the count of warnings 获取警告数量warnings()Get the list of warnings 获取警告列表
-
Constructor Details
-
ValidationResult
-
-
Method Details
-
success
Create a successful validation result 创建成功的验证结果- Returns:
- a successful validation result | 成功的验证结果
-
error
Create a validation result with a single error 创建带单个错误的验证结果- Parameters:
error- the error message | 错误消息- Returns:
- a validation result with the error | 带错误的验证结果
-
warning
Create a validation result with a single warning 创建带单个警告的验证结果- Parameters:
warning- the warning message | 警告消息- Returns:
- a validation result with the warning | 带警告的验证结果
-
warnings
-
errors
-
isValid
public boolean isValid()Check if validation passed (no errors) 检查验证是否通过(无错误)- Returns:
- true if valid | 如果有效返回true
-
hasErrors
public boolean hasErrors()Check if there are errors 检查是否有错误- Returns:
- true if there are errors | 如果有错误返回true
-
hasWarnings
public boolean hasWarnings()Check if there are warnings 检查是否有警告- Returns:
- true if there are warnings | 如果有警告返回true
-
errorCount
public int errorCount()Get the count of errors 获取错误数量- Returns:
- error count | 错误数量
-
warningCount
public int warningCount()Get the count of warnings 获取警告数量- Returns:
- warning count | 警告数量
-
merge
Merge with another validation result 与另一个验证结果合并- Parameters:
other- the other validation result | 另一个验证结果- Returns:
- merged validation result | 合并的验证结果
-
toString
-