Enum Class HitPolicy

java.lang.Object
java.lang.Enum<HitPolicy>
cloud.opencode.base.rules.decision.HitPolicy
All Implemented Interfaces:
Serializable, Comparable<HitPolicy>, Constable

public enum HitPolicy extends Enum<HitPolicy>
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 Constants
    Enum Constant
    Description
    Any - 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

    Modifier and Type
    Method
    Description
    static HitPolicy
    Returns the enum constant of this class with the specified name.
    static HitPolicy[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • UNIQUE

      public static final HitPolicy UNIQUE
      Unique - Only one row can match (error if multiple match) 唯一 - 只能有一行匹配(如果多行匹配则报错)
    • FIRST

      public static final HitPolicy FIRST
      First - Return the first matching row 首个 - 返回第一个匹配的行
    • PRIORITY

      public static final HitPolicy PRIORITY
      Priority - Return the row with highest priority 优先级 - 返回优先级最高的行
    • ANY

      public static final HitPolicy ANY
      Any - Return any matching row (all matches must produce same output) 任意 - 返回任意匹配的行(所有匹配必须产生相同输出)
    • COLLECT

      public static final HitPolicy COLLECT
      Collect - Return all matching rows 收集 - 返回所有匹配的行
    • RULE_ORDER

      public static final HitPolicy RULE_ORDER
      Rule Order - Return all matches in rule definition order 规则顺序 - 按规则定义顺序返回所有匹配
    • OUTPUT_ORDER

      public static final HitPolicy OUTPUT_ORDER
      Output Order - Return all matches ordered by output values 输出顺序 - 按输出值排序返回所有匹配
  • Method Details

    • values

      public static HitPolicy[] 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

      public static HitPolicy valueOf(String name)
      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 name
      NullPointerException - if the argument is null