All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fengwenyi.erwin.validation.constraints.ValidTimestamp Maven / Gradle / Ivy

The newest version!
package com.fengwenyi.erwin.validation.constraints;

import com.fengwenyi.erwin.validation.validator.TimestampValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;

/**
 * 时间戳有效性校验
 *
 * 

* 注意,这几个参数只能一个为true *

* * @author Erwin Feng * @since 2022-07-08 */ @Constraint(validatedBy = {TimestampValidator.class}) @Documented @Retention(RetentionPolicy.RUNTIME) @Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER}) public @interface ValidTimestamp { String message() default "timestamp invalid"; Class[] groups() default {}; Class[] payload() default {}; /** * 过去 * @return true-校验,false-不校验 */ boolean past() default false; /** * 未来 * @return true-校验,false-不校验 */ boolean future() default false; /** * 过去或者现在 * @return true-校验,false-不校验 */ boolean pastOrPresent() default false; /** * 未来或者现在 * @return true-校验,false-不校验 */ boolean futureOrPresent() default false; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy