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

Examples of org.internna.iwebmvc.core.validation.annotation.DateConstraint.minValue()


        final DateConstraint dateConstraint = field.getAnnotation(DateConstraint.class);
        Set<ValidationError> errors = new HashSet<ValidationError>();
        if (dateConstraint != null) {
            if (dateConstraint.required() & (object == null)) errors.add(new ValidationError(field.getName(), errorCodes[0], dateConstraint, object));
            if (object != null) {
                Calendar min = dateConstraint.minValue().getDate(false);
                Calendar max = dateConstraint.maxValue().getDate(true);
                Calendar date = Calendar.getInstance();
                date.setTime((Date) object);
                if (date.before(min)) errors.add(new ValidationError(field.getName(), errorCodes[2], dateConstraint, object));
                if (date.after(max)) errors.add(new ValidationError(field.getName(), errorCodes[3], dateConstraint, object));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.