public boolean isValid(String s) throws ValidationException {
try {
final int i = Integer.parseInt(s);
if (i <= 0 || i >= 6) {
//throw ValidationException to indicate a problem, with a reason
throw new ValidationException("Must be between 1 and 5");
}
} catch (NumberFormatException e) {
throw new ValidationException("Not a valid integer");
}
return true;
}
})