Class RuleGroup
java.lang.Object
cloud.opencode.base.rules.model.RuleGroup
- All Implemented Interfaces:
Comparable<RuleGroup>
Rule Group - Collection of Related Rules
规则组 - 相关规则的集合
Groups related rules together for organization and selective execution.
将相关规则组织在一起以便组织和选择性执行。
Features | 主要功能:
- Named grouping - 命名分组
- Priority ordering - 优先级排序
- Description support - 描述支持
Usage Examples | 使用示例:
RuleGroup group = RuleGroup.builder("discount-rules")
.description("Order discount calculation rules")
.priority(1)
.addRule(vipRule)
.addRule(bulkRule)
.build();
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Null-safe: No (name must not be null) - 空值安全: 否(名称不能为null)
- Since:
- JDK 25, opencode-base-rules V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for RuleGroup RuleGroup的构建器 -
Method Summary
Modifier and TypeMethodDescriptionstatic RuleGroup.BuilderCreates a builder for RuleGroup 创建RuleGroup的构建器intGets the group description 获取组描述getName()Gets the group name 获取组名intGets the group priority 获取组优先级getRules()Gets the rules in this group 获取此组中的规则booleanisEmpty()Checks if this group is empty 检查此组是否为空intsize()Gets the count of rules in this group 获取此组中的规则数量
-
Method Details
-
getName
-
getDescription
-
getPriority
public int getPriority()Gets the group priority 获取组优先级- Returns:
- the priority | 优先级
-
getRules
-
size
public int size()Gets the count of rules in this group 获取此组中的规则数量- Returns:
- rule count | 规则数量
-
isEmpty
public boolean isEmpty()Checks if this group is empty 检查此组是否为空- Returns:
- true if empty | 如果为空返回true
-
compareTo
- Specified by:
compareToin interfaceComparable<RuleGroup>
-
builder
Creates a builder for RuleGroup 创建RuleGroup的构建器- Parameters:
name- the group name | 组名- Returns:
- the builder | 构建器
-