Class DefaultPrompt

java.lang.Object
org.jline.prompt.impl.DefaultPrompt
All Implemented Interfaces:
Prompt
Direct Known Subclasses:
DefaultCheckboxPrompt, DefaultChoicePrompt, DefaultConfirmPrompt, DefaultEditorPrompt, DefaultInputPrompt, DefaultKeyPressPrompt, DefaultListPrompt, DefaultSearchPrompt, DefaultTextPrompt, DefaultTogglePrompt

public abstract class DefaultPrompt extends Object implements Prompt
Base implementation class for all prompt types. This is now the native implementation that doesn't depend on console-ui.
  • Field Details

    • name

      protected final String name
    • message

      protected final String message
  • Constructor Details

    • DefaultPrompt

      protected DefaultPrompt(String name, String message)
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Prompt
      Get the name of this prompt. The name is used as the key in the result map.
      Specified by:
      getName in interface Prompt
      Returns:
      the name of this prompt
    • getMessage

      public String getMessage()
      Description copied from interface: Prompt
      Get the message to display to the user.
      Specified by:
      getMessage in interface Prompt
      Returns:
      the message
    • getTransformer

      public Function<String,String> getTransformer()
      Description copied from interface: Prompt
      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 "***".
      Specified by:
      getTransformer in interface Prompt
      Returns:
      the transformer function, or null for default display
    • getFilter

      public Function<String,String> getFilter()
      Description copied from interface: Prompt
      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.
      Specified by:
      getFilter in interface Prompt
      Returns:
      the filter function, or null for no filtering
    • setTransformer

      public void setTransformer(Function<String,String> transformer)
    • setFilter

      public void setFilter(Function<String,String> filter)