Record Class FeatureAuditEvent
java.lang.Object
java.lang.Record
cloud.opencode.base.feature.audit.FeatureAuditEvent
- Record Components:
featureKey- the feature key | 功能键operatorId- the operator ID | 操作者IDaction- the action performed | 执行的操作oldValue- the old enabled state | 旧的启用状态newValue- the new enabled state | 新的启用状态timestamp- the event timestamp | 事件时间戳Features | 主要功能:
- Immutable audit event record - 不可变的审计事件记录
- Captures feature name, action, user, and timestamp - 捕获功能名称、操作、用户和时间戳
Security | 安全性:
- Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
- Null-safe: No - 空值安全: 否
public record FeatureAuditEvent(String featureKey, String operatorId, String action, boolean oldValue, boolean newValue, Instant timestamp)
extends Record
Feature Audit Event
功能审计事件
Immutable record representing a feature audit event.
表示功能审计事件的不可变记录。
Actions | 操作类型:
- REGISTER - Feature registration | 功能注册
- ENABLE - Feature enabled | 功能启用
- DISABLE - Feature disabled | 功能禁用
- UPDATE_STRATEGY - Strategy updated | 策略更新
- DELETE - Feature deleted | 功能删除
Usage Examples | 使用示例:
FeatureAuditEvent event = new FeatureAuditEvent(
"dark-mode",
"admin@example.com",
"ENABLE",
false,
true,
Instant.now()
);
auditLogger.log(event);
- Since:
- JDK 25, opencode-base-feature V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFeatureAuditEvent(String featureKey, String operatorId, String action, boolean oldValue, boolean newValue, Instant timestamp) Creates an instance of aFeatureAuditEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefeatureKeyrecord component.final inthashCode()Returns a hash code value for this object.booleanCheck if this event represents a state change 检查此事件是否表示状态更改booleannewValue()Returns the value of thenewValuerecord component.booleanoldValue()Returns the value of theoldValuerecord component.Returns the value of theoperatorIdrecord component.Returns the value of thetimestamprecord component.Format as log string 格式化为日志字符串final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FeatureAuditEvent
public FeatureAuditEvent(String featureKey, String operatorId, String action, boolean oldValue, boolean newValue, Instant timestamp) Creates an instance of aFeatureAuditEventrecord class.- Parameters:
featureKey- the value for thefeatureKeyrecord componentoperatorId- the value for theoperatorIdrecord componentaction- the value for theactionrecord componentoldValue- the value for theoldValuerecord componentnewValue- the value for thenewValuerecord componenttimestamp- the value for thetimestamprecord component
-
-
Method Details
-
isStateChanged
public boolean isStateChanged()Check if this event represents a state change 检查此事件是否表示状态更改- Returns:
- true if state changed | 如果状态更改返回true
-
toLogString
Format as log string 格式化为日志字符串- Returns:
- formatted log string | 格式化的日志字符串
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
featureKey
Returns the value of thefeatureKeyrecord component.- Returns:
- the value of the
featureKeyrecord component
-
operatorId
Returns the value of theoperatorIdrecord component.- Returns:
- the value of the
operatorIdrecord component
-
action
-
oldValue
-
newValue
-
timestamp
-