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

com.cookingfox.lapasse.api.command.handler.RxCommandHandler Maven / Gradle / Ivy

The newest version!
package com.cookingfox.lapasse.api.command.handler;

import com.cookingfox.lapasse.api.command.Command;
import com.cookingfox.lapasse.api.event.Event;
import com.cookingfox.lapasse.api.state.State;
import rx.Observable;

/**
 * Command handler that returns an Rx Observable for the event it produces.
 *
 * @param  The concrete type of the state object.
 * @param  The concrete command type that this handler will handle.
 * @param  The concrete event type that this handler will produce.
 */
public interface RxCommandHandler
        extends CommandHandler {

    /**
     * Handle a command and return an Rx Observable.
     *
     * @param state   The current state object.
     * @param command The command object to handle.
     * @return An Rx Observable for the event.
     */
    Observable handle(S state, C command);

}