private void validate(Validator<String> validator, String valueToValidate) throws ValidationException { ValidationBean validationBean = validator.validate(valueToValidate); if (!validationBean.isValid()) { throw new ValidationException(validationBean.getError()); } }
public void validateEmail() throws ValidationException { validate(Validator.lengthValidator(255), getEmail()); validate(Validator.EMAIL, getEmail()); }
public void validateMatcher() throws ValidationException { validate(Validator.lengthValidator(255), getMatcher()); }