wang-hao-jie
2022-06-06 4e837c1e8c6f8a7252fb95776a1530ab737bb684
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
34
35
36
37
package cn.exrick.xboot.core.common.validator;
 
import javax.validation.Constraint;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
 
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
/**
 * @author exrick
 */
@Target({FIELD})
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = {DateValidatorImpl.class})
public @interface DateValidator {
 
    /**
     * 必须的属性
     */
    String message() default "日期字符格式不匹配";
 
    /**
     * 必须的属性
     * 用于分组校验
     */
    Class[] groups() default {};
 
    Class[] payload() default {};
 
    /**
     * 非必须 接收用户校验的时间格式
     */
    String dateFormat() default "yyyy-MM-dd HH:mm:ss";
}