01: package org.jreform.criteria;
02:
03: /**
04: * Checks that the value is less than or equal to the given {@link Comparable}.
05: *
06: * @author armandino (at) gmail.com
07: */
08: public final class Max<T extends Comparable<T>> extends
09: AbstractCriterion<T> {
10: private T max;
11:
12: Max(T max) {
13: this .max = max;
14: }
15:
16: protected boolean verify(T value) {
17: return value.compareTo(max) <= 0;
18: }
19:
20: protected String generateErrorMessage() {
21: return "The value must not be greater than " + max;
22: }
23:
24: }
|