/** * Returns the value if it is not empty of a placeholder if it is. * * @param x * @return */ protected String getValue(String x) { return isEmpty(x) ? getPlaceHolder() : x; }
/** * Creates the input prompt and shows the supplied default value. This returns the default if the default value is chosen * and the input value otherwise. If supplied the default value is a null, then this is shown too. * * @param prompt * @param defaultValue * @return */ protected String getInput(String prompt, String defaultValue) { sayi2(prompt + "[" + (defaultValue == null ? "(null)" : defaultValue) + "]:"); String inLine = readline(); if (isEmpty(inLine)) { // assumption is that the default value is required return defaultValue; // no input. User hit a return } return inLine; }