Record Class ValidationReport

java.lang.Object
java.lang.Record
cloud.opencode.base.rules.validation.ValidationReport
Record Components:
issues - the list of validation issues | 验证问题列表

public record ValidationReport(List<ValidationIssue> issues) extends Record
Validation Report - Aggregated Result of Rule Set Validation 验证报告 - 规则集验证的聚合结果

Collects all validation issues found during rule validation and provides convenience methods for querying errors, warnings, and overall validity.

收集规则验证期间发现的所有验证问题,并提供便捷方法查询错误、警告和整体有效性。

Since:
JDK 25, opencode-base-rules V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a validation report with a defensive copy of the issues list 使用问题列表的防御性副本创建验证报告
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns only ERROR-level issues 仅返回ERROR级别的问题
    boolean
    Checks whether any ERROR-level issues exist 检查是否存在ERROR级别的问题
    final int
    Returns a hash code value for this object.
    boolean
    Checks whether any WARNING-level issues exist 检查是否存在WARNING级别的问题
    int
    Returns the total number of issues 返回问题总数
    Returns the value of the issues record component.
    boolean
    Checks whether the rule set is valid (no ERROR-level issues) 检查规则集是否有效(没有ERROR级别的问题)
    Returns a string representation of this record class.
    Returns a valid report with no issues 返回没有问题的有效报告
    Returns only WARNING-level issues 仅返回WARNING级别的问题

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ValidationReport

      public ValidationReport(List<ValidationIssue> issues)
      Creates a validation report with a defensive copy of the issues list 使用问题列表的防御性副本创建验证报告
      Parameters:
      issues - the validation issues | 验证问题
  • Method Details

    • valid

      public static ValidationReport valid()
      Returns a valid report with no issues 返回没有问题的有效报告
      Returns:
      an empty valid report | 空的有效报告
    • isValid

      public boolean isValid()
      Checks whether the rule set is valid (no ERROR-level issues) 检查规则集是否有效(没有ERROR级别的问题)
      Returns:
      true if no errors exist | 如果没有错误返回true
    • hasWarnings

      public boolean hasWarnings()
      Checks whether any WARNING-level issues exist 检查是否存在WARNING级别的问题
      Returns:
      true if warnings exist | 如果存在警告返回true
    • hasErrors

      public boolean hasErrors()
      Checks whether any ERROR-level issues exist 检查是否存在ERROR级别的问题
      Returns:
      true if errors exist | 如果存在错误返回true
    • errors

      public List<ValidationIssue> errors()
      Returns only ERROR-level issues 仅返回ERROR级别的问题
      Returns:
      list of error issues | 错误问题列表
    • warnings

      public List<ValidationIssue> warnings()
      Returns only WARNING-level issues 仅返回WARNING级别的问题
      Returns:
      list of warning issues | 警告问题列表
    • issueCount

      public int issueCount()
      Returns the total number of issues 返回问题总数
      Returns:
      issue count | 问题数量
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • issues

      public List<ValidationIssue> issues()
      Returns the value of the issues record component.
      Returns:
      the value of the issues record component