feat: 完善注释

This commit is contained in:
gaibu 2023-01-16 21:50:09 +08:00
parent c60f8d6da2
commit e5ab9b71b6
8 changed files with 17 additions and 41 deletions

View File

@ -17,18 +17,15 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@Desensitize(desensitizationBy = EmailDesensitizationHandler.class) // 邮箱;比如example@gmail.com脱敏之后为e****@gmail.com
@Desensitize(desensitizationBy = EmailDesensitizationHandler.class)
public @interface EmailDesensitize {
/**
* 匹配的正则表达式默认匹配所有
* 匹配的正则表达式
*/
String regex() default "(^.)[^@]*(@.*$)";
/**
* 替换规则会将匹配到的字符串全部替换成 replacer
* 例如regex=123; replacer=******
* 原始字符串 123456789
* 脱敏后字符串 ******456789
* 替换规则邮箱;比如example@gmail.com脱敏之后为e****@gmail.com
*/
String replacer() default "$1****$2";
}

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@Desensitize(desensitizationBy = BankCardDesensitization.class)// 银行卡号;比如9988002866797031脱敏之后为998800********31
@Desensitize(desensitizationBy = BankCardDesensitization.class)
public @interface BankCard {
/**
@ -31,10 +31,7 @@ public @interface BankCard {
int suffixKeep() default 2;
/**
* 替换规则会将前缀后缀保留后全部替换成 replacer
* 例如prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 原始字符串 123456
* 脱敏后 1***56
* 替换规则银行卡号;比如9988002866797031脱敏之后为998800********31
*/
String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@Desensitize(desensitizationBy = CarLicenseDesensitization.class) // 车牌号;比如粤A66666脱敏之后为粤A6***6
@Desensitize(desensitizationBy = CarLicenseDesensitization.class)
public @interface CarLicense {
/**
@ -31,10 +31,7 @@ public @interface CarLicense {
int suffixKeep() default 1;
/**
* 替换规则会将前缀后缀保留后全部替换成 replacer
* 例如prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 原始字符串 123456
* 脱敏后 1***56
* 替换规则车牌号;比如粤A66666脱敏之后为粤A6***6
*/
String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@Desensitize(desensitizationBy = ChineseNameDesensitization.class) // 中文名;比如刘子豪脱敏之后为刘**
@Desensitize(desensitizationBy = ChineseNameDesensitization.class)
public @interface ChineseName {
/**
@ -31,10 +31,7 @@ public @interface ChineseName {
int suffixKeep() default 0;
/**
* 替换规则会将前缀后缀保留后全部替换成 replacer
* 例如prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 原始字符串 123456
* 脱敏后 1***56
* 替换规则中文名;比如刘子豪脱敏之后为刘**
*/
String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@Desensitize(desensitizationBy = FixedPhoneDesensitization.class) // 固定电话;比如01086551122脱敏之后为0108*****22
@Desensitize(desensitizationBy = FixedPhoneDesensitization.class)
public @interface FixedPhone {
/**
@ -31,10 +31,7 @@ public @interface FixedPhone {
int suffixKeep() default 2;
/**
* 替换规则会将前缀后缀保留后全部替换成 replacer
* 例如prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 原始字符串 123456
* 脱敏后 1***56
* 替换规则固定电话;比如01086551122脱敏之后为0108*****22
*/
String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@Desensitize(desensitizationBy = IdCardDesensitization.class) // 身份证号码;比如530321199204074611脱敏之后为530321**********11
@Desensitize(desensitizationBy = IdCardDesensitization.class)
public @interface IdCard {
/**
@ -31,10 +31,7 @@ public @interface IdCard {
int suffixKeep() default 2;
/**
* 替换规则会将前缀后缀保留后全部替换成 replacer
* 例如prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 原始字符串 123456
* 脱敏后 1***56
* 替换规则身份证号码;比如530321199204074611脱敏之后为530321**********11
*/
String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@Desensitize(desensitizationBy = PasswordDesensitization.class) // 密码;比如123456脱敏之后为******
@Desensitize(desensitizationBy = PasswordDesensitization.class)
public @interface Password {
/**
@ -31,10 +31,7 @@ public @interface Password {
int suffixKeep() default 0;
/**
* 替换规则会将前缀后缀保留后全部替换成 replacer
* 例如prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 原始字符串 123456
* 脱敏后 1***56
* 替换规则密码;比如123456脱敏之后为******
*/
String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside
@Desensitize(desensitizationBy = PhoneNumberDesensitization.class) // 手机号;比如13248765917脱敏之后为132****5917
@Desensitize(desensitizationBy = PhoneNumberDesensitization.class)
public @interface PhoneNumber {
/**
@ -31,10 +31,7 @@ public @interface PhoneNumber {
int suffixKeep() default 4;
/**
* 替换规则会将前缀后缀保留后全部替换成 replacer
* 例如prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 原始字符串 123456
* 脱敏后 1***56
* 替换规则手机号;比如13248765917脱敏之后为132****5917
*/
String replacer() default "*";