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

io.github.mike10004.vhs.bmp.BmpResponseManufacturer Maven / Gradle / Ivy

There is a newer version: 0.32
Show newest version
package io.github.mike10004.vhs.bmp;

/**
 * Interface that defines a method to manufacture responses that the proxy
 * will send to the client.
 */
public interface BmpResponseManufacturer {

    /**
     * Manufactures a response for a given request.
     * @param capture the request
     * @return the response
     */
    ResponseCapture manufacture(S state, RequestCapture capture);

    S createFreshState();

    default WithState withFreshState() {
        return withState(createFreshState());
    }

    default WithState withState(S state) {
        return request -> {
            return manufacture(state, request);
        };
    }

    interface WithState {
        ResponseCapture invoke(RequestCapture request);
    }
}