DateTimePrompt Class

public class DateTimePrompt
extends Prompt<java.util.List<DateTimeResolution>>

Prompts a user for a date-time value.

Constructor Summary

Constructor Description
DateTimePrompt(String dialogId, PromptValidator<List<DateTimeResolution>> validator, String defaultLocale)

Initializes a new instance of the DateTimePrompt class.

Method Summary

Modifier and Type Method and Description
java.lang.String getDefaultLocale()

Gets the default locale used to determine language-specific behavior of the prompt.

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.util.List<DateTimeResolution>>> onRecognize(TurnContext turnContext, Map<String,Object> state, PromptOptions options)

Attempts to recognize the user's input as a date-time value.

void setDefaultLocale(String defaultLocale)

Sets the default locale used to determine language-specific behavior of the prompt.

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

DateTimePrompt

public DateTimePrompt(String dialogId, PromptValidator> validator, String defaultLocale)

Initializes a new instance of the DateTimePrompt class.

Parameters:

dialogId - The ID to assign to this prompt.
validator - Optional, a PromptValidator.FoundChoice that contains additional, custom validation for this prompt.
defaultLocale - Optional, the default locale used to determine language-specific behavior of the prompt. The locale is a 2, 3, or 4 character ISO 639 code that represents a language or language family.
                  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.

Method Details

getDefaultLocale

public String getDefaultLocale()

Gets the default locale used to determine language-specific behavior of the prompt.

Returns:

The default locale used to determine language-specific behavior of the prompt.

onPrompt

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

Prompts the user for input.

Overrides:

DateTimePrompt.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 as a date-time value.

Overrides:

DateTimePrompt.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.

setDefaultLocale

public void setDefaultLocale(String defaultLocale)

Sets the default locale used to determine language-specific behavior of the prompt.

Parameters:

defaultLocale - The default locale used to determine language-specific behavior of the prompt.

Applies to