Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.yammer.dropwizard.validation;
 
 
Check that a com.yammer.dropwizard.util.Size being validated is greater than or equal to the minimum value specified.
public class MinSizeValidator implements ConstraintValidator<MinSizeSize> {
    private long minQty;
    private SizeUnit minUnit;
    @Override
    public void initialize(MinSize constraintAnnotation) {
        this. = constraintAnnotation.value();
        this. = constraintAnnotation.unit();
    }
    @Override
    public boolean isValid(Size valueConstraintValidatorContext context) {
        return (value == null) || (value.toBytes() >= .toBytes());
    }
New to GrepCode? Check out our FAQ X