public String prompt( String message, String defaultReply ) throws PrompterException { writePrompt( formatMessage( message, null, defaultReply ) ); String line = readLine(); if ( StringUtils.isEmpty( line ) ) { line = defaultReply; } return line; }
@SuppressWarnings( "rawtypes" ) public String prompt( String message, List possibleValues ) throws PrompterException { return prompt( message, possibleValues, null ); }
private void writePrompt( String message ) throws PrompterException { showMessage( message + ": " ); }
public String prompt( String message ) throws PrompterException { writePrompt( message ); return readLine(); }
public String promptForPassword( String message ) throws PrompterException { writePrompt( message ); try { return inputHandler.readPassword(); } catch ( IOException e ) { throw new PrompterException( "Failed to read user response", e ); } }
public String prompt( String message ) throws PrompterException { writePrompt( message ); return readLine(); }
public String promptForPassword( String message ) throws PrompterException { writePrompt( message ); try { return inputHandler.readPassword(); } catch ( IOException e ) { throw new PrompterException( "Failed to read user response", e ); } }
public String prompt( String message, String defaultReply ) throws PrompterException { writePrompt( formatMessage( message, null, defaultReply ) ); String line = readLine(); if ( StringUtils.isEmpty( line ) ) { line = defaultReply; } return line; }
@SuppressWarnings( "rawtypes" ) public String prompt( String message, List possibleValues ) throws PrompterException { return prompt( message, possibleValues, null ); }
private void writePrompt( String message ) throws PrompterException { showMessage( message + ": " ); }
@SuppressWarnings( { "rawtypes", "unchecked" } ) public String prompt( String message, List possibleValues, String defaultReply ) throws PrompterException { String formattedMessage = formatMessage( message, possibleValues, defaultReply ); String line; do { writePrompt( formattedMessage ); line = readLine(); if ( StringUtils.isEmpty( line ) ) { line = defaultReply; } if ( line != null && !possibleValues.contains( line ) ) { try { outputHandler.writeLine( "Invalid selection." ); } catch ( IOException e ) { throw new PrompterException( "Failed to present feedback", e ); } } } while ( line == null || !possibleValues.contains( line ) ); return line; }
@SuppressWarnings( { "rawtypes", "unchecked" } ) public String prompt( String message, List possibleValues, String defaultReply ) throws PrompterException { String formattedMessage = formatMessage( message, possibleValues, defaultReply ); String line; do { writePrompt( formattedMessage ); line = readLine(); if ( StringUtils.isEmpty( line ) ) { line = defaultReply; } if ( line != null && !possibleValues.contains( line ) ) { try { outputHandler.writeLine( "Invalid selection." ); } catch ( IOException e ) { throw new PrompterException( "Failed to present feedback", e ); } } } while ( line == null || !possibleValues.contains( line ) ); return line; }