Dialog Class
- java.
lang. Object - com.
microsoft. bot. dialogs. Dialog
- com.
public abstract class Dialog
Base class for all dialogs.
Field Summary
| Modifier and Type | Field and Description |
|---|---|
|
static final
Dialog |
END_OF_TURN
A DialogTurnResult that indicates that the current dialog is still active and waiting for input from the user next turn. |
Constructor Summary
| Constructor | Description |
|---|---|
| Dialog(String dialogId) |
Initializes a new instance of the Dialog class. |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
java.util.concurrent.CompletableFuture<Dialog |
beginDialog(DialogContext dc)
Called when the dialog is started and pushed onto the dialog stack. |
|
abstract
java.util.concurrent.CompletableFuture<Dialog |
beginDialog(DialogContext dc, Object options)
Called when the dialog is started and pushed onto the dialog stack. |
|
java.util.concurrent.CompletableFuture<Dialog |
continueDialog(DialogContext dc)
Called when the dialog is _continued_, where it is the active dialog and the user replies with a new activity. |
| java.util.concurrent.CompletableFuture<java.lang.Void> |
endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)
Called when the dialog is ending. |
| java.lang.String |
getId()
Gets id for the dialog. |
|
Bot |
getTelemetryClient()
Gets the BotTelemetryClient to use for logging. |
| java.lang.String |
getVersion()
Gets a unique String which represents the version of this dialog. |
|
protected static
java.util.concurrent.CompletableFuture<Dialog |
innerRun(TurnContext turnContext, String dialogId, DialogContext dialogContext, DialogStateManagerConfiguration stateConfiguration)
Shared implementation of run with Dialog and Dialog |
| protected java.lang.String |
onComputeId()
Computes an id for the Dialog. |
| java.util.concurrent.CompletableFuture<java.lang.Boolean> |
onDialogEvent(DialogContext dc, DialogEvent e)
Called when an event has been raised, using `Dialog |
| protected java.util.concurrent.CompletableFuture<java.lang.Boolean> |
onPostBubbleEvent(DialogContext dc, DialogEvent e)
Called after an event was bubbled to all parents and wasn't handled. |
| protected java.util.concurrent.CompletableFuture<java.lang.Boolean> |
onPreBubbleEvent(DialogContext dc, DialogEvent e)
Called before an event is bubbled to its parent. |
| java.util.concurrent.CompletableFuture<java.lang.Void> |
repromptDialog(TurnContext turnContext, DialogInstance instance)
Called when the dialog should re-prompt the user for input. |
|
java.util.concurrent.CompletableFuture<Dialog |
resumeDialog(DialogContext dc, DialogReason reason)
Called when a child dialog completed this turn, returning control to this dialog. |
|
java.util.concurrent.CompletableFuture<Dialog |
resumeDialog(DialogContext dc, DialogReason reason, Object result)
Called when a child dialog completed this turn, returning control to this dialog. |
| static java.util.concurrent.CompletableFuture<java.lang.Void> |
run(Dialog dialog, TurnContext turnContext, StatePropertyAccessor<DialogState> accessor)
Creates a dialog stack and starts a dialog, pushing it onto the stack. |
| void |
setId(String withId)
Sets id for the dialog. |
| void |
setTelemetryClient(BotTelemetryClient withTelemetryClient)
Sets the BotTelemetryClient to use for logging. |
Methods inherited from java.lang.Object
Field Details
END_OF_TURN
public static final DialogTurnResult END_OF_TURN
A DialogTurnResult that indicates that the current dialog is still active and waiting for input from the user next turn.
Constructor Details
Dialog
public Dialog(String dialogId)
Initializes a new instance of the Dialog class.
Parameters:
Method Details
beginDialog
public CompletableFuture
Called when the dialog is started and pushed onto the dialog stack.
Parameters:
Returns:
beginDialog
public abstract CompletableFuture
Called when the dialog is started and pushed onto the dialog stack.
Parameters:
Returns:
continueDialog
public CompletableFuture
Called when the dialog is _continued_, where it is the active dialog and the user replies with a new activity.
If this method is *not* overridden, the dialog automatically ends when the user replies.
Parameters:
Returns:
endDialog
public CompletableFuture
Called when the dialog is ending.
Parameters:
Returns:
getId
public String getId()
Gets id for the dialog.
Returns:
getTelemetryClient
public BotTelemetryClient getTelemetryClient()
Gets the BotTelemetryClient to use for logging.
Returns:
getVersion
public String getVersion()
Gets a unique String which represents the version of this dialog. If the version changes between turns the dialog system will emit a DialogChanged event.
Returns:
innerRun
protected static CompletableFuture
Shared implementation of run with Dialog and DialogManager.
Parameters:
Returns:
onComputeId
protected String onComputeId()
Computes an id for the Dialog.
Returns:
onDialogEvent
public CompletableFuture
Called when an event has been raised, using `DialogContext.emitEvent()`, by either the current dialog or a dialog that the current dialog started.
Parameters:
Returns:
onPostBubbleEvent
protected CompletableFuture
Called after an event was bubbled to all parents and wasn't handled.
This is a good place to perform default processing logic for an event. Returning `true` will prevent any processing of the event by child dialogs.
Parameters:
Returns:
onPreBubbleEvent
protected CompletableFuture
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.
Parameters:
Returns:
repromptDialog
public CompletableFuture
Called when the dialog should re-prompt the user for input.
Parameters:
Returns:
resumeDialog
public CompletableFuture
Called when a child dialog completed this turn, returning control to this dialog.
Generally, the child dialog was started with a call to beginDialog(DialogContext dc, Object options) However, if the replaceDialog(String dialogId) method is called, the logical child dialog may be different than the original.
If this method is *not* overridden, the dialog automatically ends when the user replies.
Parameters:
Returns:
resumeDialog
public CompletableFuture
Called when a child dialog completed this turn, returning control to this dialog.
Generally, the child dialog was started with a call to beginDialog(DialogContext dc, Object options) However, if the replaceDialog(String dialogId, Object options) method is called, the logical child dialog may be different than the original.
If this method is *not* overridden, the dialog automatically ends when the user replies.
Parameters:
Returns:
run
public static CompletableFuture
Creates a dialog stack and starts a dialog, pushing it onto the stack.
Parameters:
Returns:
setId
public void setId(String withId)
Sets id for the dialog.
Parameters:
setTelemetryClient
public void setTelemetryClient(BotTelemetryClient withTelemetryClient)
Sets the BotTelemetryClient to use for logging.
Parameters: