潘志宝
2024-12-31 c903e9db81839c62dc3a046cfe3434d1a58726ce
提交 | 用户 | 时间
e7c126 1 package com.iailab.framework.desensitize.core.base.annotation;
H 2
3 import com.iailab.framework.desensitize.core.base.handler.DesensitizationHandler;
4 import com.iailab.framework.desensitize.core.base.serializer.StringDesensitizeSerializer;
5 import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
6 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
7
8 import java.lang.annotation.Documented;
9 import java.lang.annotation.ElementType;
10 import java.lang.annotation.Retention;
11 import java.lang.annotation.RetentionPolicy;
12 import java.lang.annotation.Target;
13
14 /**
15  * 顶级脱敏注解,自定义注解需要使用此注解
16  *
17  * @author gaibu
18  */
19 @Documented
20 @Target(ElementType.ANNOTATION_TYPE)
21 @Retention(RetentionPolicy.RUNTIME)
22 @JacksonAnnotationsInside // 此注解是其他所有 jackson 注解的元注解,打上了此注解的注解表明是 jackson 注解的一部分
23 @JsonSerialize(using = StringDesensitizeSerializer.class) // 指定序列化器
24 public @interface DesensitizeBy {
25
26     /**
27      * 脱敏处理器
28      */
29     @SuppressWarnings("rawtypes")
30     Class<? extends DesensitizationHandler> handler();
31
32 }