-
- All Superinterfaces:
BaseBuilder<ChoiceBuilder>
- All Known Implementing Classes:
DefaultChoiceBuilder
public interface ChoiceBuilder extends BaseBuilder<ChoiceBuilder>
Builder for choice prompts.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ChoiceBuilderadd()Add the current choice to the list.default ChoiceBuilderadd(java.lang.String name, java.lang.String text, char key)Convenience method to add a simple choice item with name, text, and key.default ChoiceBuilderadd(java.lang.String name, java.lang.String text, char key, boolean defaultChoice)Convenience method to add a choice item with name, text, key, and default state.default ChoiceBuilderadd(java.lang.String name, java.lang.String text, char key, java.lang.String helpText, boolean defaultChoice)Convenience method to add a choice item with all options.ChoiceBuilderdefaultChoice(boolean defaultChoice)Set whether the current choice is the default.ChoiceBuilderhelpText(java.lang.String helpText)Set the help text for the current choice.ChoiceBuilderkey(char key)Set the key for the current choice.ChoiceBuildernewChoice(java.lang.String id)Create a new choice with the given ID.ChoiceBuildertext(java.lang.String text)Set the text for the current choice.-
Methods inherited from interface org.jline.prompt.BaseBuilder
addPrompt, filter, message, name, transformer
-
-
-
-
Method Detail
-
newChoice
ChoiceBuilder newChoice(java.lang.String id)
Create a new choice with the given ID.- Parameters:
id- the ID- Returns:
- this builder
-
key
ChoiceBuilder key(char key)
Set the key for the current choice.- Parameters:
key- the key- Returns:
- this builder
-
text
ChoiceBuilder text(java.lang.String text)
Set the text for the current choice.- Parameters:
text- the text- Returns:
- this builder
-
helpText
ChoiceBuilder helpText(java.lang.String helpText)
Set the help text for the current choice.- Parameters:
helpText- the help text- Returns:
- this builder
-
defaultChoice
ChoiceBuilder defaultChoice(boolean 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
default ChoiceBuilder add(java.lang.String name, java.lang.String text, char key)
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
default ChoiceBuilder add(java.lang.String name, java.lang.String text, char key, boolean defaultChoice)
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(java.lang.String name, java.lang.String text, char key, java.lang.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
-
-