Record Class FeatureSnapshot
java.lang.Object
java.lang.Record
cloud.opencode.base.feature.FeatureSnapshot
- Record Components:
features- the feature map | 功能映射timestamp- the snapshot timestamp | 快照时间戳Security | 安全性:
- Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
- Null-safe: Partial (validates inputs) - 空值安全: 部分(验证输入)
Feature Snapshot
功能快照
Immutable snapshot of all features at a point in time.
某一时刻所有功能的不可变快照。
Features | 主要功能:
- Capture feature state - 捕获功能状态
- Restore feature state - 恢复功能状态
- Point-in-time snapshot - 时间点快照
Usage Examples | 使用示例:
FeatureSnapshot snapshot = openFeature.snapshot();
// ... modify features ...
openFeature.restore(snapshot); // restore to previous state
- Since:
- JDK 25, opencode-base-feature V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureSnapshot(Map<String, Feature> features, Instant timestamp) Compact constructor with validation 带验证的紧凑构造函数 -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if this snapshot contains a feature with the given key 检查此快照是否包含具有给定键的功能final booleanIndicates whether some other object is "equal to" this one.features()Returns the value of thefeaturesrecord component.final inthashCode()Returns a hash code value for this object.intsize()Get the number of features in this snapshot 获取此快照中的功能数量Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FeatureSnapshot
-
-
Method Details
-
size
public int size()Get the number of features in this snapshot 获取此快照中的功能数量- Returns:
- the size | 大小
-
contains
Check if this snapshot contains a feature with the given key 检查此快照是否包含具有给定键的功能- Parameters:
key- the feature key | 功能键- Returns:
- true if contains | 如果包含返回true
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
features
-
timestamp
-