public String verify(String value) { String result = notNullOrEmpty.verify(value); if (result != null) { return result; } if (!StringUtil.isInteger(value)) { return value + " is not an integer."; } return null; } }
public String verify(String value) { String result = notNullOrEmpty.verify(value); if (result != null) { return result; } if (!StringUtil.isPositiveInteger(value)) { return value + " is not a positive integer."; } return null; } }
/** * Compares the text field's value to the list of {@link DataVerifier} objects to ensure the validity of the data. * If the text value passes all validation checks, a NULL value will be returned. Otherwise a description of * the failed validation will be returned. * * @return NULL if the text in the field is valid. A description of the failure otherwise. */ public String verifyText() { if (verifiers.isEmpty()) { return null; } String result = null; for (DataVerifier v : verifiers) { result = v.verify(getText()); if (result != null) { break; } } return result; }