io.dropwizard.validation.PortRange Maven / Gradle / Ivy
package io.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 static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* A constraint that allows one to specify a port range, but still allow 0 as the port value to
* indicate dynamically allocated ports.
*
*/
@Target({ METHOD, FIELD, ANNOTATION_TYPE })
@Retention(RUNTIME)
@Constraint(validatedBy = PortRangeValidator.class)
@Documented
public @interface PortRange {
int min() default 1;
int max() default 65535;
String message() default "{org.hibernate.validator.constraints.Range.message}";
Class>[] groups() default {};
Class extends Payload>[] payload() default {};
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy