houzhongyi
2024-07-11 e7c1260db32209a078a962aaa0ad5492c35774fb
提交 | 用户 | 时间
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.EmailDesensitizationHandler;
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})
20 @Retention(RetentionPolicy.RUNTIME)
21 @JacksonAnnotationsInside
22 @DesensitizeBy(handler = EmailDesensitizationHandler.class)
23 public @interface EmailDesensitize {
24
25     /**
26      * 匹配的正则表达式
27      */
28     String regex() default "(^.)[^@]*(@.*$)";
29
30     /**
31      * 替换规则,邮箱;
32      *
33      * 比如:example@gmail.com 脱敏之后为 e****@gmail.com
34      */
35     String replacer() default "$1****$2";
36 }