Record Class RuleResult.RuleError

java.lang.Object
java.lang.Record
cloud.opencode.base.rules.RuleResult.RuleError
Record Components:
ruleName - the rule that failed | 失败的规则
message - the error message | 错误消息
cause - the cause, may be null | 原因,可能为null
Enclosing class:
RuleResult

public static record RuleResult.RuleError(String ruleName, String message, Throwable cause) extends Record
Rule Error - Details about a rule execution failure 规则错误 - 规则执行失败的详细信息
Since:
JDK 25, opencode-base-rules V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • RuleError

      public RuleError(String ruleName, String message, Throwable cause)
      Creates an instance of a RuleError record class.
      Parameters:
      ruleName - the value for the ruleName record component
      message - the value for the message record component
      cause - the value for the cause record component
  • Method Details

    • of

      public static RuleResult.RuleError of(String ruleName, String message)
      Creates a rule error without cause 创建没有原因的规则错误
      Parameters:
      ruleName - the rule name | 规则名称
      message - the error message | 错误消息
      Returns:
      rule error instance | 规则错误实例
    • of

      public static RuleResult.RuleError of(String ruleName, String message, Throwable cause)
      Creates a rule error with cause 创建带原因的规则错误
      Parameters:
      ruleName - the rule name | 规则名称
      message - the error message | 错误消息
      cause - the cause | 原因
      Returns:
      rule error instance | 规则错误实例
    • toString

      public final 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.
    • ruleName

      public String ruleName()
      Returns the value of the ruleName record component.
      Returns:
      the value of the ruleName record component
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • cause

      public Throwable cause()
      Returns the value of the cause record component.
      Returns:
      the value of the cause record component