try {
long value = Long.parseLong(str);
if(value < Integer.MIN_VALUE || value > Integer.MAX_VALUE)
return new ValidationResult(getErrorMessage(allMessages, messages.notAnInteger()));
}catch(NumberFormatException ex) {
return new ValidationResult(getErrorMessage(allMessages, messages.notAnInteger()));
}
}
return null;
}