java.lang.Object
org.jline.prompt.impl.DefaultChoiceBuilder
- All Implemented Interfaces:
BaseBuilder<ChoiceBuilder>,ChoiceBuilder
Default implementation of ChoiceBuilder.
This is now the native implementation that doesn't depend on console-ui.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultChoiceBuilder(PromptBuilder parent) Create a new DefaultChoiceBuilder with the given parent. -
Method Summary
Modifier and TypeMethodDescriptionadd()Add the current choice to the list.Add this prompt to the parent builder.defaultChoice(boolean defaultChoice) Set whether the current choice is the default.Set a filter function that modifies the actual returned value.Set the help text for the current choice.key(char key) Set the key for the current choice.Set the message to display to the user.Set the name of this prompt.Create a new choice with the given ID.Set the text for the current choice.transformer(Function<String, String> transformer) Set a transformer function that modifies how the answer is displayed after submission.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jline.prompt.ChoiceBuilder
add, add, add
-
Constructor Details
-
DefaultChoiceBuilder
Create a new DefaultChoiceBuilder with the given parent.- Parameters:
parent- the parent builder
-
-
Method Details
-
name
Set the name of this prompt.- Specified by:
namein interfaceBaseBuilder<ChoiceBuilder>- Parameters:
name- the name- Returns:
- this builder
-
message
Set the message to display to the user.- Specified by:
messagein interfaceBaseBuilder<ChoiceBuilder>- Parameters:
message- the message- Returns:
- this builder
-
newChoice
Create a new choice with the given ID.- Specified by:
newChoicein interfaceChoiceBuilder- Parameters:
id- the ID- Returns:
- this builder
-
key
Set the key for the current choice.- Specified by:
keyin interfaceChoiceBuilder- Parameters:
key- the key- Returns:
- this builder
-
text
Set the text for the current choice.- Specified by:
textin interfaceChoiceBuilder- Parameters:
text- the text- Returns:
- this builder
-
helpText
Set the help text for the current choice.- Specified by:
helpTextin interfaceChoiceBuilder- Parameters:
helpText- the help text- Returns:
- this builder
-
defaultChoice
Set whether the current choice is the default.- Specified by:
defaultChoicein interfaceChoiceBuilder- Parameters:
defaultChoice- whether the choice is the default- Returns:
- this builder
-
add
Add the current choice to the list.- Specified by:
addin interfaceChoiceBuilder- Returns:
- this builder
-
transformer
Description copied from interface:BaseBuilderSet a 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:
transformerin interfaceBaseBuilder<ChoiceBuilder>- Parameters:
transformer- the transformer function- Returns:
- this builder instance for method chaining
-
filter
Description copied from interface:BaseBuilderSet a 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:
filterin interfaceBaseBuilder<ChoiceBuilder>- Parameters:
filter- the filter function- Returns:
- this builder instance for method chaining
-
addPrompt
Add this prompt to the parent builder.- Specified by:
addPromptin interfaceBaseBuilder<ChoiceBuilder>- Returns:
- the parent
PromptBuilderfor continued prompt configuration - See Also:
-