feat: 修改脱敏注解名称

pull/2/head
gaibu 2023-01-19 20:16:03 +08:00
parent 2aa208f441
commit 729ec31dab
19 changed files with 82 additions and 82 deletions

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@DesensitizeBy(handler = DefaultRegexDesensitizationHandler.class) @DesensitizeBy(handler = DefaultRegexDesensitizationHandler.class)
public @interface Regex { public @interface RegexDesensitize {
/** /**
* *

View File

@ -1,21 +1,21 @@
package cn.iocoder.yudao.framework.desensitize.core.regex.handler; package cn.iocoder.yudao.framework.desensitize.core.regex.handler;
import cn.iocoder.yudao.framework.desensitize.core.regex.annotation.Regex; import cn.iocoder.yudao.framework.desensitize.core.regex.annotation.RegexDesensitize;
/** /**
* {@link Regex} * {@link RegexDesensitize}
* *
* @author gaibu * @author gaibu
*/ */
public class DefaultRegexDesensitizationHandler extends AbstractRegexDesensitizationHandler<Regex> { public class DefaultRegexDesensitizationHandler extends AbstractRegexDesensitizationHandler<RegexDesensitize> {
@Override @Override
String getRegex(Regex annotation) { String getRegex(RegexDesensitize annotation) {
return annotation.regex(); return annotation.regex();
} }
@Override @Override
String getReplacer(Regex annotation) { String getReplacer(RegexDesensitize annotation) {
return annotation.replacer(); return annotation.replacer();
} }
} }

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@DesensitizeBy(handler = BankCardDesensitization.class) @DesensitizeBy(handler = BankCardDesensitization.class)
public @interface BankCard { public @interface BankCardDesensitize {
/** /**
* *

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@DesensitizeBy(handler = CarLicenseDesensitization.class) @DesensitizeBy(handler = CarLicenseDesensitization.class)
public @interface CarLicense { public @interface CarLicenseDesensitize {
/** /**
* *

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@DesensitizeBy(handler = ChineseNameDesensitization.class) @DesensitizeBy(handler = ChineseNameDesensitization.class)
public @interface ChineseName { public @interface ChineseNameDesensitize {
/** /**
* *

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@DesensitizeBy(handler = FixedPhoneDesensitization.class) @DesensitizeBy(handler = FixedPhoneDesensitization.class)
public @interface FixedPhone { public @interface FixedPhoneDesensitize {
/** /**
* *

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@DesensitizeBy(handler = IdCardDesensitization.class) @DesensitizeBy(handler = IdCardDesensitization.class)
public @interface IdCard { public @interface IdCardDesensitize {
/** /**
* *

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@DesensitizeBy(handler = MobileDesensitization.class) @DesensitizeBy(handler = MobileDesensitization.class)
public @interface Mobile { public @interface MobileDesensitize {
/** /**
* *

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@DesensitizeBy(handler = PasswordDesensitization.class) @DesensitizeBy(handler = PasswordDesensitization.class)
public @interface Password { public @interface PasswordDesensitize {
/** /**
* *

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@JacksonAnnotationsInside @JacksonAnnotationsInside
@DesensitizeBy(handler = DefaultDesensitizationHandler.class) @DesensitizeBy(handler = DefaultDesensitizationHandler.class)
public @interface Slider { public @interface SliderDesensitize {
/** /**
* *

View File

@ -1,26 +1,26 @@
package cn.iocoder.yudao.framework.desensitize.core.slider.handler; package cn.iocoder.yudao.framework.desensitize.core.slider.handler;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.BankCard; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.BankCardDesensitize;
/** /**
* {@link BankCard} * {@link BankCardDesensitize}
* *
* @author gaibu * @author gaibu
*/ */
public class BankCardDesensitization extends AbstractDesensitizationHandler<BankCard> { public class BankCardDesensitization extends AbstractDesensitizationHandler<BankCardDesensitize> {
@Override @Override
Integer getPrefixKeep(BankCard annotation) { Integer getPrefixKeep(BankCardDesensitize annotation) {
return annotation.prefixKeep(); return annotation.prefixKeep();
} }
@Override @Override
Integer getSuffixKeep(BankCard annotation) { Integer getSuffixKeep(BankCardDesensitize annotation) {
return annotation.suffixKeep(); return annotation.suffixKeep();
} }
@Override @Override
String getReplacer(BankCard annotation) { String getReplacer(BankCardDesensitize annotation) {
return annotation.replacer(); return annotation.replacer();
} }

View File

@ -1,25 +1,25 @@
package cn.iocoder.yudao.framework.desensitize.core.slider.handler; package cn.iocoder.yudao.framework.desensitize.core.slider.handler;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.CarLicense; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.CarLicenseDesensitize;
/** /**
* {@link CarLicense} * {@link CarLicenseDesensitize}
* *
* @author gaibu * @author gaibu
*/ */
public class CarLicenseDesensitization extends AbstractDesensitizationHandler<CarLicense> { public class CarLicenseDesensitization extends AbstractDesensitizationHandler<CarLicenseDesensitize> {
@Override @Override
Integer getPrefixKeep(CarLicense annotation) { Integer getPrefixKeep(CarLicenseDesensitize annotation) {
return annotation.prefixKeep(); return annotation.prefixKeep();
} }
@Override @Override
Integer getSuffixKeep(CarLicense annotation) { Integer getSuffixKeep(CarLicenseDesensitize annotation) {
return annotation.suffixKeep(); return annotation.suffixKeep();
} }
@Override @Override
String getReplacer(CarLicense annotation) { String getReplacer(CarLicenseDesensitize annotation) {
return annotation.replacer(); return annotation.replacer();
} }
} }

View File

@ -1,26 +1,26 @@
package cn.iocoder.yudao.framework.desensitize.core.slider.handler; package cn.iocoder.yudao.framework.desensitize.core.slider.handler;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.ChineseName; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.ChineseNameDesensitize;
/** /**
* {@link ChineseName} * {@link ChineseNameDesensitize}
* *
* @author gaibu * @author gaibu
*/ */
public class ChineseNameDesensitization extends AbstractDesensitizationHandler<ChineseName> { public class ChineseNameDesensitization extends AbstractDesensitizationHandler<ChineseNameDesensitize> {
@Override @Override
Integer getPrefixKeep(ChineseName annotation) { Integer getPrefixKeep(ChineseNameDesensitize annotation) {
return annotation.prefixKeep(); return annotation.prefixKeep();
} }
@Override @Override
Integer getSuffixKeep(ChineseName annotation) { Integer getSuffixKeep(ChineseNameDesensitize annotation) {
return annotation.suffixKeep(); return annotation.suffixKeep();
} }
@Override @Override
String getReplacer(ChineseName annotation) { String getReplacer(ChineseNameDesensitize annotation) {
return annotation.replacer(); return annotation.replacer();
} }

View File

@ -1,25 +1,25 @@
package cn.iocoder.yudao.framework.desensitize.core.slider.handler; package cn.iocoder.yudao.framework.desensitize.core.slider.handler;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.Slider; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.SliderDesensitize;
/** /**
* {@link Slider} * {@link SliderDesensitize}
* *
* @author gaibu * @author gaibu
*/ */
public class DefaultDesensitizationHandler extends AbstractDesensitizationHandler<Slider> { public class DefaultDesensitizationHandler extends AbstractDesensitizationHandler<SliderDesensitize> {
@Override @Override
Integer getPrefixKeep(Slider annotation) { Integer getPrefixKeep(SliderDesensitize annotation) {
return annotation.prefixKeep(); return annotation.prefixKeep();
} }
@Override @Override
Integer getSuffixKeep(Slider annotation) { Integer getSuffixKeep(SliderDesensitize annotation) {
return annotation.suffixKeep(); return annotation.suffixKeep();
} }
@Override @Override
String getReplacer(Slider annotation) { String getReplacer(SliderDesensitize annotation) {
return annotation.replacer(); return annotation.replacer();
} }
} }

View File

@ -1,25 +1,25 @@
package cn.iocoder.yudao.framework.desensitize.core.slider.handler; package cn.iocoder.yudao.framework.desensitize.core.slider.handler;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.FixedPhone; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.FixedPhoneDesensitize;
/** /**
* {@link FixedPhone} * {@link FixedPhoneDesensitize}
* *
* @author gaibu * @author gaibu
*/ */
public class FixedPhoneDesensitization extends AbstractDesensitizationHandler<FixedPhone> { public class FixedPhoneDesensitization extends AbstractDesensitizationHandler<FixedPhoneDesensitize> {
@Override @Override
Integer getPrefixKeep(FixedPhone annotation) { Integer getPrefixKeep(FixedPhoneDesensitize annotation) {
return annotation.prefixKeep(); return annotation.prefixKeep();
} }
@Override @Override
Integer getSuffixKeep(FixedPhone annotation) { Integer getSuffixKeep(FixedPhoneDesensitize annotation) {
return annotation.suffixKeep(); return annotation.suffixKeep();
} }
@Override @Override
String getReplacer(FixedPhone annotation) { String getReplacer(FixedPhoneDesensitize annotation) {
return annotation.replacer(); return annotation.replacer();
} }
} }

View File

@ -1,25 +1,25 @@
package cn.iocoder.yudao.framework.desensitize.core.slider.handler; package cn.iocoder.yudao.framework.desensitize.core.slider.handler;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.IdCard; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.IdCardDesensitize;
/** /**
* {@link IdCard} * {@link IdCardDesensitize}
* *
* @author gaibu * @author gaibu
*/ */
public class IdCardDesensitization extends AbstractDesensitizationHandler<IdCard> { public class IdCardDesensitization extends AbstractDesensitizationHandler<IdCardDesensitize> {
@Override @Override
Integer getPrefixKeep(IdCard annotation) { Integer getPrefixKeep(IdCardDesensitize annotation) {
return annotation.prefixKeep(); return annotation.prefixKeep();
} }
@Override @Override
Integer getSuffixKeep(IdCard annotation) { Integer getSuffixKeep(IdCardDesensitize annotation) {
return annotation.suffixKeep(); return annotation.suffixKeep();
} }
@Override @Override
String getReplacer(IdCard annotation) { String getReplacer(IdCardDesensitize annotation) {
return annotation.replacer(); return annotation.replacer();
} }
} }

View File

@ -1,26 +1,26 @@
package cn.iocoder.yudao.framework.desensitize.core.slider.handler; package cn.iocoder.yudao.framework.desensitize.core.slider.handler;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.Mobile; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.MobileDesensitize;
/** /**
* {@link Mobile} * {@link MobileDesensitize}
* *
* @author gaibu * @author gaibu
*/ */
public class MobileDesensitization extends AbstractDesensitizationHandler<Mobile> { public class MobileDesensitization extends AbstractDesensitizationHandler<MobileDesensitize> {
@Override @Override
Integer getPrefixKeep(Mobile annotation) { Integer getPrefixKeep(MobileDesensitize annotation) {
return annotation.prefixKeep(); return annotation.prefixKeep();
} }
@Override @Override
Integer getSuffixKeep(Mobile annotation) { Integer getSuffixKeep(MobileDesensitize annotation) {
return annotation.suffixKeep(); return annotation.suffixKeep();
} }
@Override @Override
String getReplacer(Mobile annotation) { String getReplacer(MobileDesensitize annotation) {
return annotation.replacer(); return annotation.replacer();
} }
} }

View File

@ -1,25 +1,25 @@
package cn.iocoder.yudao.framework.desensitize.core.slider.handler; package cn.iocoder.yudao.framework.desensitize.core.slider.handler;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.Password; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.PasswordDesensitize;
/** /**
* {@link Password} * {@link PasswordDesensitize}
* *
* @author gaibu * @author gaibu
*/ */
public class PasswordDesensitization extends AbstractDesensitizationHandler<Password> { public class PasswordDesensitization extends AbstractDesensitizationHandler<PasswordDesensitize> {
@Override @Override
Integer getPrefixKeep(Password annotation) { Integer getPrefixKeep(PasswordDesensitize annotation) {
return annotation.prefixKeep(); return annotation.prefixKeep();
} }
@Override @Override
Integer getSuffixKeep(Password annotation) { Integer getSuffixKeep(PasswordDesensitize annotation) {
return annotation.suffixKeep(); return annotation.suffixKeep();
} }
@Override @Override
String getReplacer(Password annotation) { String getReplacer(PasswordDesensitize annotation) {
return annotation.replacer(); return annotation.replacer();
} }
} }

View File

@ -2,16 +2,16 @@ package cn.iocoder.yudao.framework.desensitize.core;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.desensitize.core.regex.annotation.EmailDesensitize; import cn.iocoder.yudao.framework.desensitize.core.regex.annotation.EmailDesensitize;
import cn.iocoder.yudao.framework.desensitize.core.regex.annotation.Regex; import cn.iocoder.yudao.framework.desensitize.core.regex.annotation.RegexDesensitize;
import cn.iocoder.yudao.framework.desensitize.core.annotation.Address; import cn.iocoder.yudao.framework.desensitize.core.annotation.Address;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.BankCard; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.BankCardDesensitize;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.CarLicense; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.CarLicenseDesensitize;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.ChineseName; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.ChineseNameDesensitize;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.FixedPhone; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.FixedPhoneDesensitize;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.IdCard; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.IdCardDesensitize;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.Password; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.PasswordDesensitize;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.Mobile; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.MobileDesensitize;
import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.Slider; import cn.iocoder.yudao.framework.desensitize.core.slider.annotation.SliderDesensitize;
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
import lombok.Data; import lombok.Data;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -65,29 +65,29 @@ public class DesensitizeTest extends BaseMockitoUnitTest {
@Data @Data
public static class DesensitizeDemo { public static class DesensitizeDemo {
@ChineseName @ChineseNameDesensitize
private String nickname; private String nickname;
@BankCard @BankCardDesensitize
private String bankCard; private String bankCard;
@CarLicense @CarLicenseDesensitize
private String carLicense; private String carLicense;
@FixedPhone @FixedPhoneDesensitize
private String fixedPhone; private String fixedPhone;
@IdCard @IdCardDesensitize
private String idCard; private String idCard;
@Password @PasswordDesensitize
private String password; private String password;
@Mobile @MobileDesensitize
private String phoneNumber; private String phoneNumber;
@Slider(prefixKeep = 6, suffixKeep = 1, replacer = "#") @SliderDesensitize(prefixKeep = 6, suffixKeep = 1, replacer = "#")
private String slider1; private String slider1;
@Slider(prefixKeep = 3, suffixKeep = 3) @SliderDesensitize(prefixKeep = 3, suffixKeep = 3)
private String slider2; private String slider2;
@Slider(prefixKeep = 10) @SliderDesensitize(prefixKeep = 10)
private String slider3; private String slider3;
@EmailDesensitize @EmailDesensitize
private String email; private String email;
@Regex(regex = "芋道源码", replacer = "*") @RegexDesensitize(regex = "芋道源码", replacer = "*")
private String regex; private String regex;
@Address @Address
private String address; private String address;