public boolean isInputValid() {
    if (validator == null) {
      return !TextUtils.isEmpty(getText());
    }

    return validator.isValid(getText().toString());
  }
 public String getValidationFailedMessage() {
   return validator == null ? null : validator.getExplanationMessage();
 }