- All Superinterfaces:
BaseBuilder<ChoiceBuilder>
- All Known Implementing Classes:
DefaultChoiceBuilder
Builder for choice prompts.
-
Method Summary
Modifier and TypeMethodDescriptionadd()Add the current choice to the list.default ChoiceBuilderConvenience method to add a simple choice item with name, text, and key.default ChoiceBuilderConvenience method to add a choice item with name, text, key, and default state.default ChoiceBuilderConvenience method to add a choice item with all options.defaultChoice(boolean defaultChoice) Set whether the current choice is the default.Set the help text for the current choice.key(char key) Set the key for the current choice.Create a new choice with the given ID.Set the text for the current choice.Methods inherited from interface org.jline.prompt.BaseBuilder
addPrompt, filter, message, name, transformer
-
Method Details
-
newChoice
Create a new choice with the given ID.- Parameters:
id- the ID- Returns:
- this builder
-
key
Set the key for the current choice.- Parameters:
key- the key- Returns:
- this builder
-
text
Set the text for the current choice.- Parameters:
text- the text- Returns:
- this builder
-
helpText
Set the help text for the current choice.- Parameters:
helpText- the help text- Returns:
- this builder
-
defaultChoice
Set whether the current choice is the default.- Parameters:
defaultChoice- whether the choice is the default- Returns:
- this builder
-
add
ChoiceBuilder add()Add the current choice to the list.- Returns:
- this builder
-
add
Convenience method to add a simple choice item with name, text, and key.- Parameters:
name- the item name/idtext- the display textkey- the key to select this choice- Returns:
- this builder
-
add
Convenience method to add a choice item with name, text, key, and default state.- Parameters:
name- the item name/idtext- the display textkey- the key to select this choicedefaultChoice- whether this is the default choice- Returns:
- this builder
-
add
default ChoiceBuilder add(String name, String text, char key, String helpText, boolean defaultChoice) Convenience method to add a choice item with all options.- Parameters:
name- the item name/idtext- the display textkey- the key to select this choicehelpText- the help text for this choicedefaultChoice- whether this is the default choice- Returns:
- this builder
-