Record Class RuleTrace
java.lang.Object
java.lang.Record
cloud.opencode.base.rules.trace.RuleTrace
- Record Components:
ruleName- the rule name | 规则名称conditionResult- whether condition evaluated to true | 条件是否评估为trueexecuted- whether action was executed | 动作是否已执行duration- evaluation + execution time | 评估和执行时间error- null if no error | 如果没有错误则为nullskipped- true if rule was disabled/skipped | 如果规则被禁用/跳过则为true
public record RuleTrace(String ruleName, boolean conditionResult, boolean executed, Duration duration, Throwable error, boolean skipped)
extends Record
Rule Trace - Records the Execution Trace of a Single Rule
规则轨迹 - 记录单个规则的执行轨迹
Captures whether a rule's condition matched, whether its action was executed, the duration of evaluation and execution, and any error that occurred.
捕获规则条件是否匹配、动作是否执行、评估和执行的持续时间以及发生的任何错误。
- Since:
- JDK 25, opencode-base-rules V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of theconditionResultrecord component.duration()Returns the value of thedurationrecord component.final booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.booleanexecuted()Returns the value of theexecutedrecord component.static RuleTraceCreates a trace for a rule that failed during execution 创建执行期间失败的规则轨迹static RuleTraceCreates a trace for a rule that fired (condition matched and action executed) 创建已触发规则的轨迹(条件匹配且动作已执行)booleanReturns whether this rule failed during execution 返回此规则在执行期间是否失败booleanhasFired()Returns whether this rule fired (condition matched and action executed) 返回此规则是否已触发(条件匹配且动作已执行)final inthashCode()Returns a hash code value for this object.static RuleTracenotMatched(String name, Duration duration) Creates a trace for a rule whose condition did not match 创建条件不匹配的规则轨迹ruleName()Returns the value of theruleNamerecord component.booleanskipped()Returns the value of theskippedrecord component.static RuleTraceCreates a trace for a rule that was skipped (disabled) 创建被跳过(禁用)的规则轨迹final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
RuleTrace
public RuleTrace(String ruleName, boolean conditionResult, boolean executed, Duration duration, Throwable error, boolean skipped) Canonical constructor with validation 带验证的规范构造函数- Parameters:
ruleName- the rule name | 规则名称conditionResult- whether condition evaluated to true | 条件是否评估为trueexecuted- whether action was executed | 动作是否已执行duration- evaluation + execution time | 评估和执行时间error- null if no error | 如果没有错误则为nullskipped- true if rule was disabled/skipped | 如果规则被禁用/跳过则为true
-
-
Method Details
-
fired
-
notMatched
-
skipped
-
failed
Creates a trace for a rule that failed during execution 创建执行期间失败的规则轨迹- Parameters:
name- the rule name | 规则名称duration- the evaluation + execution duration | 评估和执行持续时间error- the error that occurred | 发生的错误- Returns:
- the rule trace | 规则轨迹
-
hasFired
public boolean hasFired()Returns whether this rule fired (condition matched and action executed) 返回此规则是否已触发(条件匹配且动作已执行)- Returns:
- true if the rule fired | 如果规则已触发返回true
-
hasFailed
public boolean hasFailed()Returns whether this rule failed during execution 返回此规则在执行期间是否失败- Returns:
- true if the rule failed | 如果规则失败返回true
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
ruleName
-
conditionResult
public boolean conditionResult()Returns the value of theconditionResultrecord component.- Returns:
- the value of the
conditionResultrecord component
-
executed
-
duration
-
error
-
skipped
-