Class RuleGroupBuilder
java.lang.Object
cloud.opencode.base.rules.dsl.RuleGroupBuilder
Rule Group Builder - Fluent DSL for Rule Group Construction
规则组构建器 - 规则组构建的流式DSL
Provides a fluent API for constructing rule groups.
提供用于构建规则组的流式API。
Features | 主要功能:
- Fluent builder API - 流式构建器API
- Rule collection management - 规则集合管理
- Priority and description support - 优先级和描述支持
Usage Examples | 使用示例:
RuleGroup group = RuleGroupBuilder.group("discount-rules")
.description("Order discount calculation rules")
.priority(1)
.addRule(vipRule)
.addRule(bulkRule)
.build();
Security | 安全性:
- Thread-safe: No (builder pattern, single-threaded use) - 线程安全: 否(构建器模式,单线程使用)
- Null-safe: No (name and rules must not be null) - 空值安全: 否(名称和规则不能为null)
Performance | 性能特性:
- Time complexity: O(1) per rule addition - 每次规则添加 O(1)
- Space complexity: O(n) where n = rules in group - O(n), n为组内规则数
- Since:
- JDK 25, opencode-base-rules V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRuleGroupBuilder(String name) Creates a rule group builder with the given name 使用给定名称创建规则组构建器 -
Method Summary
Modifier and TypeMethodDescriptionAdds a rule to the group 向组添加规则Adds multiple rules to the group 向组添加多个规则Adds multiple rules to the group 向组添加多个规则build()Builds the rule group 构建规则组description(String description) Sets the group description 设置组描述static RuleGroupBuilderCreates a rule group builder with the given name 使用给定名称创建规则组构建器priority(int priority) Sets the group priority 设置组优先级
-
Constructor Details
-
RuleGroupBuilder
Creates a rule group builder with the given name 使用给定名称创建规则组构建器- Parameters:
name- the group name | 组名
-
-
Method Details
-
group
Creates a rule group builder with the given name 使用给定名称创建规则组构建器- Parameters:
name- the group name | 组名- Returns:
- the builder | 构建器
-
description
Sets the group description 设置组描述- Parameters:
description- the description | 描述- Returns:
- this builder | 此构建器
-
priority
Sets the group priority 设置组优先级- Parameters:
priority- the priority | 优先级- Returns:
- this builder | 此构建器
-
addRule
Adds a rule to the group 向组添加规则- Parameters:
rule- the rule | 规则- Returns:
- this builder | 此构建器
-
addRules
Adds multiple rules to the group 向组添加多个规则- Parameters:
rules- the rules | 规则- Returns:
- this builder | 此构建器
-
addRules
Adds multiple rules to the group 向组添加多个规则- Parameters:
rules- the rules | 规则- Returns:
- this builder | 此构建器
-
build
-