*/
public void validate(final int i, final ValidationContext context)
throws ValidationException {
if (_useFixed && i != _fixed) {
String err = "int " + i + " is not equal to the fixed value: " + _fixed;
throw new ValidationException(err);
}
if (_useMin && i < _min) {
String err = "int " + i + " is less than the minimum allowed value: " + _min;
throw new ValidationException(err);
}
if (_useMax && i > _max) {
String err = "int " + i + " is greater than the maximum allowed value: " + _max;
throw new ValidationException(err);
}
if (_totalDigits != -1) {
int length = Integer.toString(i).length();
if (i < 0) {
length--;
}
if (length > _totalDigits) {
String err = "int " + i + " has too many digits -- must have "
+ _totalDigits + " digits or fewer.";
throw new ValidationException(err);
}
}
if (hasPattern()) {
super.validate(Integer.toString(i), context);