All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.compilit.mediator.api.CommandDispatcher Maven / Gradle / Ivy

The newest version!
package com.compilit.mediator.api;

/**
 * A CommandDispatcher is a dedicated interface for sending Commands to the Mediator. A Mediator should never be
 * interacted with directly because you could never truly know that your code complies with CQERS.
 *
 * @see Command
 */
public interface CommandDispatcher {

  /**
   * Send the command into the mediator. If a matching handler is found, return the result of this handler.
   *
   * @param command The specific Command you wish to send to the Mediator.
   * @param      The return type of the Command.
   * @return The return type value.
   */
   T dispatch(Command command);

  /**
   * Dispatch multiple SimpleCommands to the Mediator in order to handle it. Since you cannot state which command needs
   * to return what, only SimpleCommands can be used because they return a void.
   *
   * @param command  The specific Command you wish to send to the Mediator.
   * @param commands The extra Commands you wish to send to the Mediator.
   */
  void dispatch(SimpleCommand command, SimpleCommand... commands);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy