package com.kidgrow.common.annotation;
|
|
/**
|
* 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
|
*
|
* @Description: <br>
|
* @Project: <br>
|
* @CreateDate: Created in 2020/4/3 11:40 <br>
|
* @Author: <a href="4345453@kidgrow.com">liuke</a>
|
*/
|
|
import com.kidgrow.common.utils.KidgrowDateValidator;
|
|
import javax.validation.Constraint;
|
import javax.validation.Payload;
|
import java.lang.annotation.*;
|
|
@Documented
|
// 指定该注解可以使用的地方
|
@Target(value = {ElementType.FIELD})
|
@Retention(RetentionPolicy.RUNTIME)
|
// 指定实际进行校验的校验器,该校验器是自己写的且必须实现ConstraintValidator接口
|
@Constraint(validatedBy = KidgrowDateValidator.class)
|
public @interface DateValidator {
|
/**
|
* 时间不早于
|
* @return
|
*/
|
String minDate() default "";
|
|
/**
|
* 时间不晚于
|
* @return
|
*/
|
String maxDate() default "";
|
|
/**
|
* 时间格式定义
|
* @return
|
*/
|
String pattern() default "yyyy-MM-dd";
|
|
/**
|
* 没加default给定默认值,使用注解的时候该属性必须赋值,否则报错
|
* @return
|
*/
|
String message();
|
|
Class<?>[] groups() default {};
|
|
Class<? extends Payload>[] payload() default {};
|
}
|