DateTimePrompt 类

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

提示用户输入日期时间值。

构造函数摘要

构造函数 说明
DateTimePrompt(String dialogId, PromptValidator<List<DateTimeResolution>> validator, String defaultLocale)

初始化 DateTimePrompt 类的新实例。

方法摘要

修饰符和类型 方法和描述
java.lang.String getDefaultLocale()

获取用于确定提示语言特定行为的默认区域设置。

protected java.util.concurrent.CompletableFuture<java.lang.Void> onPrompt(TurnContext turnContext, Map<String,Object> state, PromptOptions options, Boolean isRetry)

提示用户输入。

protected java.util.concurrent.CompletableFuture<PromptRecognizerResult<java.util.List<DateTimeResolution>>> onRecognize(TurnContext turnContext, Map<String,Object> state, PromptOptions options)

尝试将用户的输入识别为日期时间值。

void setDefaultLocale(String defaultLocale)

设置用于确定提示语言特定行为的默认区域设置。

方法继承自 Dialog

方法继承自 Prompt

方法继承自 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

构造函数详细信息

DateTimePrompt

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

初始化 DateTimePrompt 类的新实例。

Parameters:

dialogId - 要分配给此提示的 ID。
validator - 可选,包含 PromptValidator.FoundChoice 此提示的其他自定义验证。
defaultLocale - 可选,用于确定提示语言特定行为的默认区域设置。 区域设置是由 2、3 或 4 个字符组成的 ISO 639 代码,代表某种语言或语言系列。
                  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.

方法详细信息

getDefaultLocale

public String getDefaultLocale()

获取用于确定提示语言特定行为的默认区域设置。

Returns:

用于确定提示语言特定行为的默认区域设置。

onPrompt

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

提示用户输入。

Overrides:

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

Parameters:

turnContext - 与用户当前轮次对话的上下文。
state - 包含对话框堆栈上提示的当前实例的状态。
options - 一个提示选项 对象,该对象是从调用 中最初提供的选项构造的 prompt(String dialogId, PromptOptions options)
isRetry - 如果这是堆栈上的此提示对话框实例首次提示用户输入,则为 true;否则为 false。

Returns:

表示异步操作的 CompletableFuture

onRecognize

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

尝试将用户的输入识别为日期时间值。

Overrides:

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

Parameters:

turnContext - 与用户当前轮次对话的上下文。
state - 包含对话框堆栈上提示的当前实例的状态。
options - 一个提示选项 对象,该对象是从调用 中最初提供的选项构造的 prompt(String dialogId, PromptOptions options)

Returns:

表示异步操作的 CompletableFuture。 如果任务成功,则结果描述识别尝试的结果。

setDefaultLocale

public void setDefaultLocale(String defaultLocale)

设置用于确定提示语言特定行为的默认区域设置。

Parameters:

defaultLocale - 用于确定提示语言特定行为的默认区域设置。

适用于