RegisterClassMiddleware<T> Class

  • java.lang.Object
    • com.microsoft.bot.builder.RegisterClassMiddleware<T>

Type Parameters

T

The typeof service to add.

Implements

public class RegisterClassMiddleware<T>
implements Middleware

Middleware for adding an object to or registering a service with the current turn context.

Constructor Summary

Constructor Description
RegisterClassMiddleware(T service)

Initializes a new instance of the RegisterClassMiddleware class.

RegisterClassMiddleware(T service, String key)

Initializes a new instance of the RegisterClassMiddleware class.

Method Summary

Modifier and Type Method and Description
T getService()

Gets the Service.

java.util.concurrent.CompletableFuture<java.lang.Void> onTurn(TurnContext turnContext, NextDelegate next)

Adds the associated object or service to the current turn context.

void setService(T withService)

Sets the Service.

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

RegisterClassMiddleware

public RegisterClassMiddleware(T service)

Initializes a new instance of the RegisterClassMiddleware class.

Parameters:

service - The Service to register.

RegisterClassMiddleware

public RegisterClassMiddleware(T service, String key)

Initializes a new instance of the RegisterClassMiddleware class.

Parameters:

service - The Service to register.
key - optional key for service object in turn state. Default is name of service.

Method Details

getService

public T getService()

Gets the Service.

Returns:

The Service.

onTurn

public CompletableFuture onTurn(TurnContext turnContext, NextDelegate next)

Adds the associated object or service to the current turn context.

Parameters:

turnContext - The context object for this turn.
next - The delegate to call to continue the bot middleware pipeline.

setService

public void setService(T withService)

Sets the Service.

Parameters:

withService - The value to set the Service to.

Applies to