Class ConsoleUserInput

java.lang.Object
org.springframework.cloud.dataflow.shell.command.ConsoleUserInput
All Implemented Interfaces:
UserInput

@Component public class ConsoleUserInput extends Object implements UserInput
UserInput that uses Standard in and out.
Author:
Eric Bottard, Gary Russell, Chris Bono
  • Constructor Details

    • ConsoleUserInput

      public ConsoleUserInput()
  • Method Details

    • promptWithOptions

      public String promptWithOptions(String prompt, String defaultValue, String... options)
      Loops until one of the options is provided. Pressing return is equivalent to returning defaultValue.
      Specified by:
      promptWithOptions in interface UserInput
      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

      public String prompt(String prompt, String defaultValue, boolean echo)
      Description copied from interface: UserInput
      Display a prompt text to the user and expect them to enter a free-form value. Optionally, the input is echoed.
      Specified by:
      prompt in interface UserInput
      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