All Known Implementing Classes:
ConsoleUserInput

public interface UserInput
Abstraction for a mechanism used to get user interactive user input.
Author:
Eric Bottard, Marius Bogoevici
  • Method Summary

    Modifier and Type
    Method
    Description
    prompt(String prompt, String defaultValue, boolean echo)
    Display a prompt text to the user and expect them to enter a free-form value.
    promptWithOptions(String prompt, String defaultValue, String... options)
    Display a prompt text to the user and expect one of options in return.
  • Method Details

    • promptWithOptions

      String promptWithOptions(String prompt, String defaultValue, String... options)
      Display a prompt text to the user and expect one of options in return.
      Parameters:
      prompt - the a message to prompt the user with
      defaultValue - the default value to be returned if the user simply presses Enter
      options - valid input option set
      Returns:
      the prompt text to display to the user
    • prompt

      String prompt(String prompt, String defaultValue, boolean echo)
      Display a prompt text to the user and expect them to enter a free-form value. Optionally, the input is echoed.
      Parameters:
      prompt - the a message to prompt the user with
      defaultValue - the default value to be returned if the user simply presses Enter
      echo - echo the input to output (set to false for sensitive input, e.g. passwords)
      Returns:
      the prompt text to display to the user