Interface SideEffectService<Context>

Type Parameters:
Context - Context type.
All Superinterfaces:
Function<Context,State>, Service<Context,State>
All Known Subinterfaces:
ConsumerService<Context>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface SideEffectService<Context> extends Service<Context,State>
Service implementation that alters the state of the owning application in some way. A SideEffectService does not return a generated result, instead it returns a response, indicating whether or not the context was consumed
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull State
    handle(@NonNull Context context)
    Consumes the context, if possible.

    Methods inherited from interface java.util.function.Function

    andThen, compose

    Methods inherited from interface cloud.commandframework.services.types.Service

    apply, order
  • Method Details

    • handle

      @NonNull State handle(@NonNull Context context) throws Exception
      Consumes the context, if possible. Returns State.ACCEPTED if the input was consumed, else State.REJECTED
      Specified by:
      handle in interface Service<Context,State>
      Parameters:
      context - context used in the generation of the response
      Returns:
      Response. If the response isn't State.ACCEPTED, the next service in the service chain will get to act on the context. Otherwise the execution halts, and the provided response is the final response.
      Throws:
      Exception - Any exception that occurs during the handling can be thrown, and will be wrapped by a PipelineException