Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.dropwizard.validation;
 
 
 import static java.lang.annotation.ElementType.*;
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.
@Constraint(validatedBy = PortRangeValidator.class)
public @interface PortRange {
    int min() default 1025;
    int max() default 65535;
    String message() default "{org.hibernate.validator.constraints.Range.message}";
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
New to GrepCode? Check out our FAQ X