Interface Handler<B extends BotConfiguration,I,O>

Type Parameters:
B - The Bot configuration
I - input type.
O - output type.
All Superinterfaces:
io.micronaut.core.order.Ordered
All Known Subinterfaces:
BasecampHandler, TelegramHandler<O>
All Known Implementing Classes:
CommandHandler

public interface Handler<B extends BotConfiguration,I,O> extends io.micronaut.core.order.Ordered
Request handlers are responsible for handling one or more types of incoming requests.
Since:
1.0.0
Author:
Sergio del Amo
  • Field Summary

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canHandle(B bot, I input)
    Returns true if the handler can dispatch the current request.
    @NonNull Optional<O>
    handle(B bot, I input)
    Handles the request.

    Methods inherited from interface io.micronaut.core.order.Ordered

    getOrder
  • Method Details

    • canHandle

      boolean canHandle(@Nullable B bot, @NonNull @NotNull I input)
      Returns true if the handler can dispatch the current request.
      Parameters:
      bot - bot being asked to handle this command
      input - input to the request handler
      Returns:
      true if the handler is capable of handling the current request
    • handle

      @NonNull @NonNull Optional<O> handle(@Nullable B bot, @NonNull @NotNull I input)
      Handles the request.
      Parameters:
      bot - bot being asked to handle this command
      input - input to the request handler
      Returns:
      output from the handler. Empty if you want to respond asynchronously.