Enum Class DesensitizeType

java.lang.Object
java.lang.Enum<DesensitizeType>
cloud.opencode.base.string.desensitize.strategy.DesensitizeType
All Implemented Interfaces:
Serializable, Comparable<DesensitizeType>, Constable

public enum DesensitizeType extends Enum<DesensitizeType>
Desensitize Type - Enum defining built-in desensitization types. 脱敏类型 - 定义内置脱敏类型的枚举。

Features | 主要功能:

  • MOBILE_PHONE - 手机号脱敏
  • ID_CARD - 身份证号脱敏
  • EMAIL - 邮箱脱敏
  • BANK_CARD - 银行卡号脱敏
  • CHINESE_NAME - 中文姓名脱敏
  • ADDRESS, PASSWORD, CUSTOM - 地址、密码、自定义脱敏

Usage Examples | 使用示例:

@Desensitize(DesensitizeType.MOBILE_PHONE)
private String phone;

String masked = OpenMask.desensitize("13812345678", DesensitizeType.MOBILE_PHONE);

Security | 安全性:

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

  • Method Details

    • values

      public static DesensitizeType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DesensitizeType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null