广丰卷烟厂数采质量分析系统
zhuguifei
2026-03-02 80ff784bf60637cd348ae665fc907f7b1e527dd8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package org.dromara.common.json.validate;
 
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
 
import java.lang.annotation.*;
 
/**
 * JSON 格式校验注解
 *
 * @author AprilWind
 */
@Documented
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = JsonPatternValidator.class)
public @interface JsonPattern {
 
    /**
     * 限制 JSON 类型,默认为 {@link JsonType#ANY},即对象或数组都允许
     */
    JsonType type() default JsonType.ANY;
 
    /**
     * 校验失败时的提示消息
     */
    String message() default "不是有效的 JSON 格式";
 
    Class<?>[] groups() default {};
 
    Class<? extends Payload>[] payload() default {};
 
}