Enum Class HitPolicy
- All Implemented Interfaces:
Serializable, Comparable<HitPolicy>, Constable
Hit Policy - Determines How Decision Table Matches Are Handled
命中策略 - 确定如何处理决策表匹配
Defines the behavior when one or more rows in a decision table match the input.
定义当决策表中一行或多行匹配输入时的行为。
Features | 主要功能:
- Seven hit policies (UNIQUE, FIRST, PRIORITY, ANY, COLLECT, RULE_ORDER, OUTPUT_ORDER) - 七种命中策略
- DMN standard compliance - 符合DMN标准
Usage Examples | 使用示例:
DecisionTable table = OpenRules.decisionTable()
.hitPolicy(HitPolicy.FIRST)
.input("status", String.class)
.output("action", String.class)
.row(new Object[]{"active"}, new Object[]{"process"})
.build();
Security | 安全性:
- Thread-safe: Yes (immutable enum) - 线程安全: 是(不可变枚举)
- Null-safe: N/A - 空值安全: 不适用
- Since:
- JDK 25, opencode-base-rules V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAny - Return any matching row (all matches must produce same output) 任意 - 返回任意匹配的行(所有匹配必须产生相同输出)Collect - Return all matching rows 收集 - 返回所有匹配的行First - Return the first matching row 首个 - 返回第一个匹配的行Output Order - Return all matches ordered by output values 输出顺序 - 按输出值排序返回所有匹配Priority - Return the row with highest priority 优先级 - 返回优先级最高的行Rule Order - Return all matches in rule definition order 规则顺序 - 按规则定义顺序返回所有匹配Unique - Only one row can match (error if multiple match) 唯一 - 只能有一行匹配(如果多行匹配则报错) -
Method Summary
-
Enum Constant Details
-
UNIQUE
Unique - Only one row can match (error if multiple match) 唯一 - 只能有一行匹配(如果多行匹配则报错) -
FIRST
First - Return the first matching row 首个 - 返回第一个匹配的行 -
PRIORITY
Priority - Return the row with highest priority 优先级 - 返回优先级最高的行 -
ANY
Any - Return any matching row (all matches must produce same output) 任意 - 返回任意匹配的行(所有匹配必须产生相同输出) -
COLLECT
Collect - Return all matching rows 收集 - 返回所有匹配的行 -
RULE_ORDER
Rule Order - Return all matches in rule definition order 规则顺序 - 按规则定义顺序返回所有匹配 -
OUTPUT_ORDER
Output Order - Return all matches ordered by output values 输出顺序 - 按输出值排序返回所有匹配
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-