TextPrompt Class

public class TextPrompt
extends Prompt<java.lang.String>

Prompts the user for text input.

Constructor Summary

Constructor Description
TextPrompt(String dialogId)

Initializes a new instance of the TextPrompt class.

TextPrompt(String dialogId, PromptValidator<String> validator)

Initializes a new instance of the TextPrompt class.

Method Summary

Modifier and Type Method and Description
protected java.util.concurrent.CompletableFuture<java.lang.Boolean> onPreBubbleEvent(DialogContext dc, DialogEvent e)

Called before an event is bubbled to its parent.

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<PromptRecognizerResult<java.lang.String>> onRecognize(TurnContext turnContext, Map<String,Object> state, PromptOptions options)

Attempts to recognize the user's input.

Methods inherited from Dialog

Methods inherited from Prompt

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

TextPrompt

public TextPrompt(String dialogId)

Initializes a new instance of the TextPrompt class.

Parameters:

dialogId - The ID to assign to this prompt. The value of dialogId must be unique within the DialogSet or ComponentDialog to which the prompt is added.

TextPrompt

public TextPrompt(String dialogId, PromptValidator validator)

Initializes a new instance of the TextPrompt class.

Parameters:

dialogId - The ID to assign to this prompt.
validator - Optional, a {@link PromptValidator{FoundChoice}} that contains additional, custom validation for this prompt. The value of dialogId must be unique within the DialogSet or ComponentDialog to which the prompt is added.

Method Details

onPreBubbleEvent

protected CompletableFuture onPreBubbleEvent(DialogContext dc, DialogEvent e)

Called before an event is bubbled to its parent. This is a good place to perform interception of an event as returning `true` will prevent any further bubbling of the event to the dialogs parents and will also prevent any child dialogs from performing their default processing.

Overrides:

TextPrompt.onPreBubbleEvent(DialogContext dc, DialogEvent e)

Parameters:

dc - The dialog context for the current turn of conversation.
e - The event being raised.

Returns:

Whether the event is handled by the current dialog and further processing should stop.

onPrompt

protected CompletableFuture onPrompt(TurnContext turnContext, Map state, PromptOptions options, Boolean isRetry)

Prompts the user for input.

Overrides:

TextPrompt.onPrompt(TurnContext turnContext, Map<String,Object> state, PromptOptions options, Boolean isRetry)

Parameters:

turnContext - Context for the current turn of conversation with the user.
state - Contains state for the current instance of the prompt on the dialog stack.
options - A prompt options Object constructed from the options initially provided in the call to prompt(String dialogId, PromptOptions options) .
isRetry - true if this is the first time this prompt dialog instance on the stack is prompting the user for input; otherwise, false.

Returns:

A CompletableFuture representing the asynchronous operation.

onRecognize

protected CompletableFuture> onRecognize(TurnContext turnContext, Map state, PromptOptions options)

Attempts to recognize the user's input.

Overrides:

TextPrompt.onRecognize(TurnContext turnContext, Map<String,Object> state, PromptOptions options)

Parameters:

turnContext - Context for the current turn of conversation with the user.
state - Contains state for the current instance of the prompt on the dialog stack.
options - A prompt options Object constructed from the options initially provided in the call to prompt(String dialogId, PromptOptions options) .

Returns:

A CompletableFuture representing the asynchronous operation. If the task is successful, the result describes the result of the recognition attempt.

Applies to