org.springframework.cloud.dataflow.shell.command

## 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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConsoleUserInput()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `prompt(String prompt, String defaultValue, boolean echo)` Display a prompt text to the user and expect them to enter a free-form value.
    `String` | `promptWithOptions(String prompt, String defaultValue, String... options)` Loops until one of the `options` is provided.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ConsoleUserInput

          public ConsoleUserInput()

  - ### Method Detail

    - #### 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

Copyright © 2021 Pivotal Software, Inc.. All rights reserved.