Class DefaultFactStore
java.lang.Object
cloud.opencode.base.rules.model.DefaultFactStore
- All Implemented Interfaces:
FactStore
Default Fact Store Implementation
默认事实存储实现
Thread-safe implementation using ConcurrentHashMap and CopyOnWriteArrayList.
使用ConcurrentHashMap和CopyOnWriteArrayList的线程安全实现。
Features | 主要功能:
- Named and typed fact storage - 命名和类型化事实存储
- Type-based retrieval - 基于类型的检索
- Concurrent access support - 并发访问支持
Usage Examples | 使用示例:
FactStore store = new DefaultFactStore();
store.add("customer", customerObj);
store.add(orderObj);
Optional<Order> order = store.get(Order.class);
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Since:
- JDK 25, opencode-base-rules V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a fact to the store 向存储添加事实voidAdds a named fact to the store 向存储添加命名事实voidclear()Clears all facts 清除所有事实booleanChecks if a fact of the given type exists 检查给定类型的事实是否存在booleanChecks if a named fact exists 检查命名事实是否存在<T> Optional<T> Gets a fact by type 按类型获取事实Gets a fact by name 按名称获取事实<T> List<T> Gets all facts of a specific type 获取特定类型的所有事实Removes a named fact 移除命名事实<T> List<T> Removes all facts of a specific type 移除特定类型的所有事实intsize()Gets the total number of facts 获取事实总数
-
Constructor Details
-
DefaultFactStore
public DefaultFactStore()
-
-
Method Details
-
add
-
add
-
get
-
get
-
getAll
-
contains
-
contains
-
remove
-
removeAll
Description copied from interface:FactStoreRemoves all facts of a specific type 移除特定类型的所有事实 -
clear
-
size
-