Record Class RuleExplanation

java.lang.Object
java.lang.Record
cloud.opencode.base.rules.explain.RuleExplanation
Record Components:
ruleName - the rule name | 规则名称
fired - whether the rule fired | 规则是否触发
reason - human-readable explanation of why it fired or didn't fire | 触发或未触发的人类可读原因

public record RuleExplanation(String ruleName, boolean fired, String reason) extends Record
Rule Explanation - Human-Readable Explanation of a Single Rule's Outcome 规则解释 - 单个规则结果的人类可读解释

Captures whether a rule fired and provides a human-readable reason.

捕获规则是否触发并提供人类可读的原因。

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

    • RuleExplanation

      public RuleExplanation(String ruleName, boolean fired, String reason)
      Canonical constructor with validation 带验证的规范构造函数
      Parameters:
      ruleName - the rule name | 规则名称
      fired - whether the rule fired | 规则是否触发
      reason - human-readable explanation | 人类可读的解释
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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
    • fired

      public boolean fired()
      Returns the value of the fired record component.
      Returns:
      the value of the fired record component
    • reason

      public String reason()
      Returns the value of the reason record component.
      Returns:
      the value of the reason record component