Annotation Interface FeatureToggle
Feature Toggle Annotation
功能开关注解
Annotation for marking methods or types as feature-gated.
用于标记方法或类型为功能门控的注解。
Features | 主要功能:
- Method-level toggle - 方法级别开关
- Type-level toggle - 类型级别开关
- Default value support - 默认值支持
Usage Examples | 使用示例:
@FeatureToggle("dark-mode")
public void renderDarkTheme() {
// Only executes if dark-mode feature is enabled
}
@FeatureToggle(value = "beta-feature", defaultEnabled = false)
public class BetaService {
// Class gated by beta-feature flag
}
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Null-safe: N/A - 空值安全: 不适用
- Since:
- JDK 25, opencode-base-feature V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanDefault enabled state when feature is not found 功能未找到时的默认启用状态Description of the feature 功能描述
-
Element Details
-
value
-
defaultEnabled
boolean defaultEnabledDefault enabled state when feature is not found 功能未找到时的默认启用状态- Returns:
- default enabled state | 默认启用状态
- Default:
false
-
description
-