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

com.github.karamelsoft.flow.api.FlowFactory Maven / Gradle / Ivy

package com.github.karamelsoft.flow.api;

import java.util.function.Supplier;

/**
 * Interface used as a {@link Flow} factory.
 *
 * @author Frederic Gendebien ([email protected]).
 */
public interface FlowFactory {

    /**
     * Creates an inactive {@link Flow}.
     *
     * @param  provided {@link Flow} type.
     *
     * @return an instance of {@link Flow}.
     */
     Flow start();

    /**
     * Creates an active orContinueWith inactive {@link Flow} from a given value.
     *
     * @param  provided {@link Flow} type.
     * @param value is the starting value of the {@link Flow}.
     *
     * @return an instance of {@link Flow}.
     */
     Flow startWith(final T value);

    /**
     * Creates an active {@link Flow} from a given {@link Supplier}.
     *
     * @param  provided {@link Flow} type.
     * @param supplier is the starting value {@link Supplier} of the {@link Flow}.
     *
     * @return an instance of {@link Flow}.
     */
     Flow startWith(final Supplier supplier);

    /**
     * Creates an active orContinueWith inactive {@link Flow} from a given {@link Flow}.
     *
     * @param  provided {@link Flow} type.
     * @param flow is the {@link Flow} which the new {@link Flow} will start from.
     *
     * @return an active instance of {@link Flow} if the given {@link Flow} is active,
     * inactive otherwise.
     */
     Flow startWith(final Flow flow);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy