Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.dropwizard.validation;
 
 
Check that a com.yammer.dropwizard.util.Duration being validated is less than or equal to the minimum value specified.
    private long maxQty;
    private TimeUnit maxUnit;
    @Override
    public void initialize(MaxDuration constraintAnnotation) {
        this. = constraintAnnotation.value();
        this. = constraintAnnotation.unit();
    }
    @Override
    public boolean isValid(Duration valueConstraintValidatorContext context) {
        return (value == null) || (value.toNanoseconds() <= .toNanos());
    }
New to GrepCode? Check out our FAQ X