Class PromptBuilder<TOption>
java.lang.Object
com.github.rvesse.airline.builder.AbstractBuilder<Prompt<TOption>>
com.github.rvesse.airline.prompts.builders.PromptBuilder<TOption>
- Type Parameters:
TOption
- Option
A prompt builder is used to define a prompt in a Fluent API style
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private TypeConverter
private PromptFormatBuilder
<TOption> private PromptFormatter
private String
private PromptOptionMatcher
<TOption> private PromptProvider
private long
private TimeUnit
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the typeClears all previously specified optionsSpecifies that the default formatter should be used, this is the list formatterSpecifies that the default option matcher be usedSpecifies that the default prompt provider should be usedSpecifies that the default type converter be usedSwitches to a child builder for the prompt formatwithFormatBuilder
(PromptFormatBuilder<TOption> formatBuilder) Specifies the prompt formatter builder to usewithFormatter
(PromptFormatter formatter) Specifies the prompt formatter to useSwitches to a child builder for the list formatterSpecifies that a list formatter should be usedEnables numeric option selectionwithOption
(TOption option) Specifies an option for the promptwithOptionMatcher
(PromptOptionMatcher<TOption> matcher) Specifies the option matcher to usewithOptions
(TOption... options) Specifies one/more options for the promptDisables numeric option selectionSpecifies that no timeout should be usedwithPromptMessage
(String message) Specifies the prompt message to displaywithPromptProvider
(PromptProvider provider) Specifies that the given prompt provider should be usedSpecifies that a question formatter should be usedwithTimeout
(long timeout) Specifies the timeoutwithTimeout
(long timeout, TimeUnit unit) Specifies the timeoutwithTimeoutUnit
(TimeUnit unit) Specifies the time unit used to apply timeouts to promptswithTypeConverter
(TypeConverter converter) Specifies the type converter to useMethods inherited from class com.github.rvesse.airline.builder.AbstractBuilder
checkNotBlank, checkNotEmpty, checkNotNull
-
Field Details
-
provider
-
formatter
-
formatBuilder
-
timeout
private long timeout -
timeoutUnit
-
allowsNumericOptionSelection
private boolean allowsNumericOptionSelection -
options
-
optionMatcher
-
message
-
converter
-
-
Constructor Details
-
PromptBuilder
public PromptBuilder()
-
-
Method Details
-
withDefaultPromptProvider
Specifies that the default prompt provider should be used- Returns:
- Builder
-
withPromptProvider
Specifies that the given prompt provider should be used- Parameters:
provider
- Prompt provider- Returns:
- Builder
-
withTimeoutUnit
Specifies the time unit used to apply timeouts to prompts- Parameters:
unit
- Time Unit- Returns:
- Builder
-
withTimeout
Specifies the timeout- Parameters:
timeout
- Timeout- Returns:
- Builder
-
withTimeout
Specifies the timeout- Parameters:
timeout
- Timeoutunit
- Time Unit- Returns:
- Builder
-
withoutTimeout
Specifies that no timeout should be used- Returns:
- Builder
-
withOptions
Specifies one/more options for the prompt- Parameters:
options
- Options- Returns:
- Builder
-
withOption
Specifies an option for the prompt- Parameters:
option
- Option- Returns:
- Builder
-
clearOptions
Clears all previously specified options- Returns:
- Builder
-
withNumericOptionSelection
Enables numeric option selection- Returns:
- Builder
-
withoutNumericOptionSelection
Disables numeric option selection- Returns:
- Builder
-
withOptionMatcher
Specifies the option matcher to use- Parameters:
matcher
- Option matcher- Returns:
- Builder
-
withDefaultOptionMatcher
Specifies that the default option matcher be used- Returns:
- Builder
-
withPromptMessage
Specifies the prompt message to display- Parameters:
message
- Message- Returns:
- Builder
-
withFormatter
Specifies the prompt formatter to use- Parameters:
formatter
- Formatter- Returns:
- Builder
-
withFormatBuilder
Specifies the prompt formatter builder to use- Parameters:
formatBuilder
- Format Builder- Returns:
- Builder
-
withFormatBuilder
Switches to a child builder for the prompt format- Returns:
- Prompt Format Builder
-
withListFormatBuilder
Switches to a child builder for the list formatter- Returns:
- List Format Builder
-
withListFormatter
Specifies that a list formatter should be used- Returns:
- Builder
-
withQuestionFormatter
Specifies that a question formatter should be used- Returns:
- Builder
-
withDefaultFormatter
Specifies that the default formatter should be used, this is the list formatter- Returns:
- Builder
-
withTypeConverter
Specifies the type converter to use- Parameters:
converter
- Type Converter- Returns:
- Builder
-
withDefaultTypeConverter
Specifies that the default type converter be used- Returns:
-
build
Description copied from class:AbstractBuilder
Builds the type- Specified by:
build
in classAbstractBuilder<Prompt<TOption>>
- Returns:
- Type instance
-