feat: 完善注释

pull/2/head
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}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@Desensitize(desensitizationBy = EmailDesensitizationHandler.class) // 邮箱;比如example@gmail.com脱敏之后为e****@gmail.com @Desensitize(desensitizationBy = EmailDesensitizationHandler.class)
public @interface EmailDesensitize { public @interface EmailDesensitize {
/** /**
* *
*/ */
String regex() default "(^.)[^@]*(@.*$)"; String regex() default "(^.)[^@]*(@.*$)";
/** /**
* replacer * ;example@gmail.come****@gmail.com
* regex=123; replacer=******
* 123456789
* ******456789
*/ */
String replacer() default "$1****$2"; String replacer() default "$1****$2";
} }

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@Desensitize(desensitizationBy = BankCardDesensitization.class)// 银行卡号;比如9988002866797031脱敏之后为998800********31 @Desensitize(desensitizationBy = BankCardDesensitization.class)
public @interface BankCard { public @interface BankCard {
/** /**
@ -31,10 +31,7 @@ public @interface BankCard {
int suffixKeep() default 2; int suffixKeep() default 2;
/** /**
* replacer * ;9988002866797031998800********31
* prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 123456
* 1***56
*/ */
String replacer() default "*"; String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@Desensitize(desensitizationBy = CarLicenseDesensitization.class) // 车牌号;比如粤A66666脱敏之后为粤A6***6 @Desensitize(desensitizationBy = CarLicenseDesensitization.class)
public @interface CarLicense { public @interface CarLicense {
/** /**
@ -31,10 +31,7 @@ public @interface CarLicense {
int suffixKeep() default 1; int suffixKeep() default 1;
/** /**
* replacer * ;A66666A6***6
* prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 123456
* 1***56
*/ */
String replacer() default "*"; String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@Desensitize(desensitizationBy = ChineseNameDesensitization.class) // 中文名;比如:刘子豪脱敏之后为刘** @Desensitize(desensitizationBy = ChineseNameDesensitization.class)
public @interface ChineseName { public @interface ChineseName {
/** /**
@ -31,10 +31,7 @@ public @interface ChineseName {
int suffixKeep() default 0; int suffixKeep() default 0;
/** /**
* replacer * ;**
* prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 123456
* 1***56
*/ */
String replacer() default "*"; String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@Desensitize(desensitizationBy = FixedPhoneDesensitization.class) // 固定电话;比如01086551122脱敏之后为0108*****22 @Desensitize(desensitizationBy = FixedPhoneDesensitization.class)
public @interface FixedPhone { public @interface FixedPhone {
/** /**
@ -31,10 +31,7 @@ public @interface FixedPhone {
int suffixKeep() default 2; int suffixKeep() default 2;
/** /**
* replacer * ;010865511220108*****22
* prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 123456
* 1***56
*/ */
String replacer() default "*"; String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@Desensitize(desensitizationBy = IdCardDesensitization.class) // 身份证号码;比如530321199204074611脱敏之后为530321**********11 @Desensitize(desensitizationBy = IdCardDesensitization.class)
public @interface IdCard { public @interface IdCard {
/** /**
@ -31,10 +31,7 @@ public @interface IdCard {
int suffixKeep() default 2; int suffixKeep() default 2;
/** /**
* replacer * ;530321199204074611530321**********11
* prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 123456
* 1***56
*/ */
String replacer() default "*"; String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@Desensitize(desensitizationBy = PasswordDesensitization.class) // 密码;比如123456脱敏之后为****** @Desensitize(desensitizationBy = PasswordDesensitization.class)
public @interface Password { public @interface Password {
/** /**
@ -31,10 +31,7 @@ public @interface Password {
int suffixKeep() default 0; int suffixKeep() default 0;
/** /**
* replacer * ;123456******
* prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 123456
* 1***56
*/ */
String replacer() default "*"; String replacer() default "*";

View File

@ -17,7 +17,7 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD}) @Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@Desensitize(desensitizationBy = PhoneNumberDesensitization.class) // 手机号;比如13248765917脱敏之后为132****5917 @Desensitize(desensitizationBy = PhoneNumberDesensitization.class)
public @interface PhoneNumber { public @interface PhoneNumber {
/** /**
@ -31,10 +31,7 @@ public @interface PhoneNumber {
int suffixKeep() default 4; int suffixKeep() default 4;
/** /**
* replacer * ;13248765917132****5917
* prefixKeep = 1; suffixKeep = 2; replacer = "*";
* 123456
* 1***56
*/ */
String replacer() default "*"; String replacer() default "*";