Interface Prompt

All Known Subinterfaces:
CheckboxPrompt, ChoicePrompt, ConfirmPrompt, EditorPrompt, InputPrompt, KeyPressPrompt, ListPrompt, NumberPrompt, PasswordPrompt, SearchPrompt<T>, TextPrompt, TogglePrompt
All Known Implementing Classes:
DefaultCheckboxPrompt, DefaultChoicePrompt, DefaultConfirmPrompt, DefaultEditorPrompt, DefaultInputPrompt, DefaultKeyPressPrompt, DefaultListPrompt, DefaultNumberPrompt, DefaultPasswordPrompt, DefaultPrompt, DefaultSearchPrompt, DefaultTextPrompt, DefaultTogglePrompt

public interface Prompt
Interface for all promptable elements in the Prompter.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the filter function that modifies the actual returned value.
    Get the message to display to the user.
    Get the name of this prompt.
    Get the transformer function that modifies how the answer is displayed after submission.
  • Method Details

    • getName

      String getName()
      Get the name of this prompt. The name is used as the key in the result map.
      Returns:
      the name of this prompt
    • getMessage

      String getMessage()
      Get the message to display to the user.
      Returns:
      the message
    • getTransformer

      default Function<String,String> getTransformer()
      Get the transformer function that modifies how the answer is displayed after submission. This does not change the actual returned value. For example, a password prompt might transform the answer to "***".
      Returns:
      the transformer function, or null for default display
    • getFilter

      default Function<String,String> getFilter()
      Get the filter function that modifies the actual returned value. This changes the value stored in the result map. For example, trimming whitespace or converting to lowercase.
      Returns:
      the filter function, or null for no filtering