- 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 java.lang.Object implements Prompt
Base implementation class for all prompt types. This is now the native implementation that doesn't depend on console-ui.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultPrompt(java.lang.String name, java.lang.String message)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.function.Function<java.lang.String,java.lang.String>getFilter()Get the filter function that modifies the actual returned value.java.lang.StringgetMessage()Get the message to display to the user.java.lang.StringgetName()Get the name of this prompt.java.util.function.Function<java.lang.String,java.lang.String>getTransformer()Get the transformer function that modifies how the answer is displayed after submission.voidsetFilter(java.util.function.Function<java.lang.String,java.lang.String> filter)voidsetTransformer(java.util.function.Function<java.lang.String,java.lang.String> transformer)
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:PromptGet the name of this prompt. The name is used as the key in the result map.
-
getMessage
public java.lang.String getMessage()
Description copied from interface:PromptGet the message to display to the user.- Specified by:
getMessagein interfacePrompt- Returns:
- the message
-
getTransformer
public java.util.function.Function<java.lang.String,java.lang.String> getTransformer()
Description copied from interface:PromptGet 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:
getTransformerin interfacePrompt- Returns:
- the transformer function, or null for default display
-
getFilter
public java.util.function.Function<java.lang.String,java.lang.String> getFilter()
Description copied from interface:PromptGet 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.
-
setTransformer
public void setTransformer(java.util.function.Function<java.lang.String,java.lang.String> transformer)
-
setFilter
public void setFilter(java.util.function.Function<java.lang.String,java.lang.String> filter)
-
-