class UserInputProperty {

  public String promptForAcceptableValue(Gfsh gfsh) {
    if (gfsh.isQuietMode() || gfsh.isHeadlessMode()) {
      return defaultValue == null ? "" : defaultValue;
    }

    String value = promptForUserInput(gfsh);

    if (value.length() > 0) {
      return value;
    }

    // when user input an empty string and a default value is supplied, return the default value
    if (value.length() == 0 && defaultValue != null) {
      return defaultValue;
    }

    // otherwise prompt till we get a non-empty value, only when this property has no default value
    while (value.length() == 0) {
      value = promptForUserInput(gfsh);
    }
    return value;
  }

    UserInputProperty(String key, String prompt, boolean isMasked);
    UserInputProperty(String key, String prompt, String defaultValue, boolean isMasked);

}