Class FileFeatureStore
java.lang.Object
cloud.opencode.base.feature.store.FileFeatureStore
- All Implemented Interfaces:
FeatureStore
File Feature Store
文件功能存储
File-based storage using simple properties format.
使用简单属性格式的文件存储。
Features | 主要功能:
- File persistence - 文件持久化
- Memory cache - 内存缓存
- Auto-reload support - 自动重载支持
File Format | 文件格式:
# Feature configuration feature.dark-mode.enabled=true feature.dark-mode.strategy=always-on feature.new-ui.enabled=true feature.new-ui.strategy=percentage feature.new-ui.percentage=50
Usage Examples | 使用示例:
FeatureStore store = new FileFeatureStore(Path.of("features.properties"));
store.save(Feature.builder("feature-1").alwaysOn().build());
store.reload(); // Reload from file
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Null-safe: Partial (validates inputs) - 空值安全: 部分(验证输入)
- Since:
- JDK 25, opencode-base-feature V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Details
-
FileFeatureStore
Create file store 创建文件存储- Parameters:
filePath- the file path | 文件路径
-
-
Method Details
-
save
Description copied from interface:FeatureStoreSave a feature 保存功能- Specified by:
savein interfaceFeatureStore- Parameters:
feature- the feature to save | 要保存的功能
-
find
Description copied from interface:FeatureStoreFind a feature by key 根据键查找功能- Specified by:
findin interfaceFeatureStore- Parameters:
key- the feature key | 功能键- Returns:
- optional containing feature if found | 如果找到则包含功能的Optional
-
findAll
Description copied from interface:FeatureStoreFind all features 查找所有功能- Specified by:
findAllin interfaceFeatureStore- Returns:
- list of all features | 所有功能的列表
-
delete
Description copied from interface:FeatureStoreDelete a feature 删除功能- Specified by:
deletein interfaceFeatureStore- Parameters:
key- the feature key | 功能键- Returns:
- true if deleted | 如果删除成功返回true
-
clear
public void clear()Description copied from interface:FeatureStoreClear all features 清除所有功能- Specified by:
clearin interfaceFeatureStore
-
reload
public void reload()Reload features from file 从文件重新加载功能 -
getFilePath
-