Annotation Interface Desensitize


@Target({FIELD,METHOD}) @Retention(RUNTIME) @Documented public @interface Desensitize
Desensitize Annotation - Marks fields for automatic desensitization. 脱敏注解 - 标记需要自动脱敏的字段。

Features | 主要功能:

  • Field-level desensitization marking - 字段级脱敏标记
  • Configurable mask character and keep lengths - 可配置掩码字符和保留长度
  • Built-in and custom strategy support - 内置和自定义策略支持

Usage Examples | 使用示例:

@Desensitize(DesensitizeType.MOBILE_PHONE)
private String phone;

@Desensitize(value = DesensitizeType.CUSTOM, startKeep = 2, endKeep = 2, maskChar = '#')
private String custom;

Security | 安全性:

  • Thread-safe: Yes (annotation is immutable) - 线程安全: 是(注解不可变)
Since:
JDK 25, opencode-base-string V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Element Details

    • value

    • startKeep

      int startKeep
      Default:
      0
    • endKeep

      int endKeep
      Default:
      0
    • maskChar

      char maskChar
      Default:
      '*'
    • customStrategy

      String customStrategy
      Default:
      ""