Interface QueryHandlingModule

All Superinterfaces:
Module, ModuleBuilder<QueryHandlingModule>

public interface QueryHandlingModule extends Module, ModuleBuilder<QueryHandlingModule>
A Module and ModuleBuilder implementation providing operation to construct a query handling application module.

The QueryHandlingModule follows a builder paradigm, wherein several QueryHandlers can be registered in either order.

To register query handlers, a similar registration phase switch should be made, by invoking QueryHandlingModule.SetupPhase.queryHandlers().

Here's an example of how to register two query handler lambdas:

 QueryHandlingModule.named("my-module")
                              .queryHandlers()
                              .queryHandler(new QualifiedName(FetchClasses.class),
                                            new QualifiedName(Classes.class),
                                            (query, context) -> { ...query handling logic... })
                              .queryHandler(new QualifiedName(FindStudentForName.class),
                                            new QualifiedName(Student.class),
                                            (query, context) -> { ...query handling logic... });
 

Note that users do not have to invoke ModuleBuilder.build() themselves when using this interface, as the ApplicationConfigurer takes care of that.

Since:
5.0.0
Author:
Steven van Beelen
  • Method Details

    • named

      static QueryHandlingModule.SetupPhase named(@Nonnull String moduleName)
      Starts a QueryHandlingModule module with the given moduleName.
      Parameters:
      moduleName - The name of the QueryHandlingModule under construction.
      Returns:
      The setup phase of this module, for a fluent API.