BotStateSet Class

  • java.lang.Object
    • com.microsoft.bot.builder.BotStateSet

public class BotStateSet

Manages a collection of botState and provides ability to load and save in parallel.

Constructor Summary

Constructor Description
BotStateSet(BotState[] withBotStates)

Initializes a new instance of the BotStateSet class.

BotStateSet(List<BotState> withBotStates)

Initializes a new instance of the BotStateSet class.

Method Summary

Modifier and Type Method and Description
BotStateSet add(BotState botState)

Adds a bot state object to the set.

java.util.List<BotState> getBotStates()

Gets the BotStates list for the BotStateSet.

java.util.concurrent.CompletableFuture<java.lang.Void> loadAll(TurnContext turnContext)

Load all BotState records in parallel.

java.util.concurrent.CompletableFuture<java.lang.Void> loadAll(TurnContext turnContext, boolean force)

Load all BotState records in parallel.

java.util.concurrent.CompletableFuture<java.lang.Void> saveAllChanges(TurnContext turnContext)

Save All BotState changes in parallel.

java.util.concurrent.CompletableFuture<java.lang.Void> saveAllChanges(TurnContext turnContext, boolean force)

Save All BotState changes in parallel.

void setBotStates(List<BotState> withBotState)

Sets the BotStates list for the BotStateSet.

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

BotStateSet

public BotStateSet(BotState[] withBotStates)

Initializes a new instance of the BotStateSet class.

Parameters:

withBotStates - vArgs list of BotState objects to manage.

BotStateSet

public BotStateSet(List withBotStates)

Initializes a new instance of the BotStateSet class.

Parameters:

withBotStates - initial list of BotState objects to manage.

Method Details

add

public BotStateSet add(BotState botState)

Adds a bot state object to the set.

Parameters:

botState - The bot state object to add.

Returns:

The updated BotStateSet, so you can fluently call add(BotState) multiple times.

getBotStates

public List getBotStates()

Gets the BotStates list for the BotStateSet.

Returns:

The BotState objects managed by this class.

loadAll

public CompletableFuture loadAll(TurnContext turnContext)

Load all BotState records in parallel.

Parameters:

turnContext - The TurnContext.

Returns:

A task that represents the work queued to execute.

loadAll

public CompletableFuture loadAll(TurnContext turnContext, boolean force)

Load all BotState records in parallel.

Parameters:

turnContext - The TurnContext.
force - should data be forced into cache.

Returns:

A task that represents the work queued to execute.

saveAllChanges

public CompletableFuture saveAllChanges(TurnContext turnContext)

Save All BotState changes in parallel.

Parameters:

turnContext - The TurnContext.

Returns:

A task that represents the work queued to execute.

saveAllChanges

public CompletableFuture saveAllChanges(TurnContext turnContext, boolean force)

Save All BotState changes in parallel.

Parameters:

turnContext - The TurnContext.
force - should data be forced to save even if no change were detected.

Returns:

A task that represents the work queued to execute.

setBotStates

public void setBotStates(List withBotState)

Sets the BotStates list for the BotStateSet.

Parameters:

withBotState - The BotState objects managed by this class.

Applies to