Skip to content

布尔开关 BOOLEAN

是/否切换开关,字段类型为 Boolean 时可自动推测,无需显式指定 type

boolean

基础用法

java
@EruptField(
    edit = @Edit(title = "是否启用", boolType = @BoolType)
)
private Boolean enabled;

配置项

java
public @interface BoolType {

    String trueText() default "Y";  // 选中时文本

    String falseText() default "N"; // 未选中时文本

}

示例

自定义文本 + 设置默认值:

java
@EruptField(
    edit = @Edit(title = "性别",
                 boolType = @BoolType(trueText = "男", falseText = "女"))
)
private Boolean sex = true;

贡献者

The avatar of contributor named as YuePeng YuePeng
The avatar of contributor named as Claude Opus 5 (1M context) Claude Opus 5 (1M context)

页面历史

Released under the Apache-2.0 License.