ChoicePrompt Class
- java.
lang. Object - com.
microsoft. bot. dialogs. Dialog - com.
microsoft. bot. dialogs. prompts. Prompt<T> - com.
microsoft. bot. dialogs. prompts. ChoicePrompt
- com.
- com.
- com.
public class ChoicePrompt
extends Prompt<FoundChoice>
Prompts a user to select from a list of choices.
Constructor Summary
| Constructor | Description |
|---|---|
| ChoicePrompt(String dialogId) |
Initializes a new instance of the ChoicePrompt class. |
| ChoicePrompt(String dialogId, PromptValidator<FoundChoice> validator, String defaultLocale) |
Initializes a new instance of the ChoicePrompt class. |
| ChoicePrompt(String dialogId, Map<String,ChoiceFactoryOptions> choiceDefaults, PromptValidator<FoundChoice> validator, String defaultLocale) |
Initializes a new instance of the ChoicePrompt class. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
Choice |
getChoiceOptions()
Gets additional options passed to the ChoiceFactory and used to tweak the style of choices rendered to the user. |
| java.lang.String |
getDefaultLocale()
Sets or sets the default locale used to determine language-specific behavior of the prompt. |
|
Find |
getRecognizerOptions()
Gets or sets additional options passed to the underlying {@link Choice |
|
List |
getStyle()
Gets the style to use when presenting the prompt to the user. |
| protected java.util.concurrent.CompletableFuture<java.lang.Void> |
onPrompt(TurnContext turnContext, Map<String,Object> state, PromptOptions options, Boolean isRetry)
Prompts the user for input. |
|
protected
java.util.concurrent.CompletableFuture<Prompt |
onRecognize(TurnContext turnContext, Map<String,Object> state, PromptOptions options)
Attempts to recognize the user's input. |
| void |
setChoiceOptions(ChoiceFactoryOptions choiceOptions)
Sets additional options passed to the ChoiceFactory and used to tweak the style of choices rendered to the user. |
| void |
setDefaultLocale(String defaultLocale)
Sets the default locale used to determine language-specific behavior of the prompt. |
| void |
setRecognizerOptions(FindChoicesOptions recognizerOptions)
Gets or sets additional options passed to the underlying {@link Choice |
| void |
setStyle(ListStyle style)
Sets the style to use when presenting the prompt to the user. |
Methods inherited from Dialog
Methods inherited from Prompt
Methods inherited from java.lang.Object
Constructor Details
ChoicePrompt
public ChoicePrompt(String dialogId)
Initializes a new instance of the ChoicePrompt class.
Parameters:
ChoicePrompt
public ChoicePrompt(String dialogId, PromptValidator
Initializes a new instance of the ChoicePrompt class.
Parameters:
The value of <xref uid="" data-throw-if-not-resolved="false" data-raw-source="dialogId"></xref> must be unique within the
<xref uid="com.microsoft.bot.dialogs.DialogSet" data-throw-if-not-resolved="false" data-raw-source="DialogSet"></xref> or <xref uid="com.microsoft.bot.dialogs.ComponentDialog" data-throw-if-not-resolved="false" data-raw-source="ComponentDialog"></xref> to which
the prompt is added. If the <xref uid="com.microsoft.bot.schema.Activity.locale" data-throw-if-not-resolved="false" data-raw-source="Activity#locale"></xref> of
the <xref uid="com.microsoft.bot.dialogs.DialogContext" data-throw-if-not-resolved="false" data-raw-source="DialogContext"></xref> .<xref uid="com.microsoft.bot.dialogs.DialogContext.context" data-throw-if-not-resolved="false" data-raw-source="DialogContext#context"></xref>
.<xref uid="" data-throw-if-not-resolved="false" data-raw-source="ITurnContext#activity"></xref> is specified, then that
local is used to determine language specific behavior;
otherwise the <xref uid="" data-throw-if-not-resolved="false" data-raw-source="defaultLocale"></xref> is used. US-English
is the used if no language or default locale is
available, or if the language or locale is not otherwise
supported.
ChoicePrompt
public ChoicePrompt(String dialogId, Map
Initializes a new instance of the ChoicePrompt class.
Parameters:
Method Details
getChoiceOptions
public ChoiceFactoryOptions getChoiceOptions()
Gets additional options passed to the ChoiceFactory and used to tweak the style of choices rendered to the user.
Returns:
getDefaultLocale
public String getDefaultLocale()
Sets or sets the default locale used to determine language-specific behavior of the prompt.
Returns:
getRecognizerOptions
public FindChoicesOptions getRecognizerOptions()
Gets or sets additional options passed to the underlying {@link ChoiceRecognizers#recognizeChoices(String, IList{Choice}, FindChoicesOptions)} method.
Returns:
getStyle
public ListStyle getStyle()
Gets the style to use when presenting the prompt to the user.
Returns:
onPrompt
protected CompletableFuture
Prompts the user for input.
Overrides:
ChoicePrompt.onPrompt(TurnContext turnContext, Map<String,Object> state, PromptOptions options, Boolean isRetry)Parameters:
Returns:
onRecognize
protected CompletableFuture
Attempts to recognize the user's input.
Overrides:
ChoicePrompt.onRecognize(TurnContext turnContext, Map<String,Object> state, PromptOptions options)Parameters:
Returns:
setChoiceOptions
public void setChoiceOptions(ChoiceFactoryOptions choiceOptions)
Sets additional options passed to the ChoiceFactory and used to tweak the style of choices rendered to the user.
Parameters:
setDefaultLocale
public void setDefaultLocale(String defaultLocale)
Sets the default locale used to determine language-specific behavior of the prompt.
Parameters:
setRecognizerOptions
public void setRecognizerOptions(FindChoicesOptions recognizerOptions)
Gets or sets additional options passed to the underlying {@link ChoiceRecognizers#recognizeChoices(String, IList{Choice}, FindChoicesOptions)} method.
Parameters:
setStyle
public void setStyle(ListStyle style)
Sets the style to use when presenting the prompt to the user.
Parameters: