潘志宝
4 天以前 10edab49cfd859ea4928c969da658b4a548f5b71
提交 | 用户 | 时间
e7c126 1 package com.iailab.framework.desensitize.core.regex.annotation;
H 2
3 import com.iailab.framework.desensitize.core.base.annotation.DesensitizeBy;
4 import com.iailab.framework.desensitize.core.regex.handler.DefaultRegexDesensitizationHandler;
5 import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
6
7 import java.lang.annotation.Documented;
8 import java.lang.annotation.ElementType;
9 import java.lang.annotation.Retention;
10 import java.lang.annotation.RetentionPolicy;
11 import java.lang.annotation.Target;
12
13 /**
14  * 正则脱敏注解
15  *
16  * @author gaibu
17  */
18 @Documented
19 @Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
20 @Retention(RetentionPolicy.RUNTIME)
21 @JacksonAnnotationsInside
22 @DesensitizeBy(handler = DefaultRegexDesensitizationHandler.class)
23 public @interface RegexDesensitize {
24
25     /**
26      * 匹配的正则表达式(默认匹配所有)
27      */
28     String regex() default "^[\\s\\S]*$";
29
30     /**
31      * 替换规则,会将匹配到的字符串全部替换成 replacer
32      *
33      * 例如:regex=123; replacer=******
34      * 原始字符串 123456789
35      * 脱敏后字符串 ******456789
36      */
37     String replacer() default "******";
38 }