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

com.yammer.dropwizard.validation.MaxDuration Maven / Gradle / Ivy

There is a newer version: 0.6.2
Show newest version
package com.yammer.dropwizard.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;

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

/**
 * The annotated element must be a {@link com.yammer.dropwizard.util.Duration}
 * whose value must be higher or equal to the specified minimum.
 * 

* null elements are considered valid */ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) @Retention(RUNTIME) @Documented @Constraint(validatedBy = MaxDurationValidator.class) public @interface MaxDuration { String message() default "must be less than or equal to {value} {unit}"; Class[] groups() default { }; @SuppressWarnings("UnusedDeclaration") Class[] payload() default { }; /** * @return value the element must be higher or equal to */ long value(); /** * @return unit of the value the element must be higher or equal to */ TimeUnit unit() default TimeUnit.SECONDS; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy