Package org.internna.iwebmvc.core.validation.annotation

Examples of org.internna.iwebmvc.core.validation.annotation.NumberConstraint


        }
        return errors;
    }

    protected Set<ValidationError> validateNumericConstraint(final Field field, final Object object) {
        final NumberConstraint numberConstraint = field.getAnnotation(NumberConstraint.class);
        Set<ValidationError> errors = new HashSet<ValidationError>();
        if (numberConstraint != null) {
            if (numberConstraint.required() & (object == null)) errors.add(new ValidationError(field.getName(), errorCodes[0], numberConstraint, object));
            if (object != null) {
                double numericValue = ((Number) object).doubleValue();
                if (numberConstraint.minValue() > numericValue) errors.add(new ValidationError(field.getName(), errorCodes[2], numberConstraint, object));
                if (numberConstraint.maxValue() < numericValue) errors.add(new ValidationError(field.getName(), errorCodes[3], numberConstraint, object));
            }
        }
        return errors;
    }
View Full Code Here

TOP

Related Classes of org.internna.iwebmvc.core.validation.annotation.NumberConstraint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.