01: package org.jreform.criteria;
02:
03: /**
04: * Checks that value is not less than the specified minimum.
05: *
06: * @author armandino (at) gmail.com
07: */
08: public final class MinLength extends AbstractCriterion<String> {
09: private int minLength;
10:
11: MinLength(int minLength) {
12: this .minLength = minLength;
13: }
14:
15: protected boolean verify(String value) {
16: return value.length() >= minLength;
17: }
18:
19: protected String generateErrorMessage() {
20: return "The value must not be less than " + minLength
21: + " characters long";
22: }
23:
24: }
|