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

io.github.gaming32.pipeline.calling.CallingPipeline Maven / Gradle / Ivy

Go to download

Library for performing fluent-style operations on Java objects. It also provides a fluent format for creating generators.

The newest version!
package io.github.gaming32.pipeline.calling;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.function.BiConsumer;
import java.util.function.BiPredicate;

public interface CallingPipeline {
    @FunctionalInterface
    public static interface OneArgCallable {
        public R call(V arg) throws Exception;
    }

    @FunctionalInterface
    public static interface OneArgNoReturnCallable {
        public void call(V arg) throws Exception;
    }

    public static enum CallingState {
        NOT_YET,
        WAITING,
        DONE,
        CANCELLED,
        EXCEPTIONAL
    }

    public static  CallingPipeline of(Callable func) {
        return new StandardCallingPipeline<>(func);
    }

    public CallingPipeline withDefaultExecutor();

    public CallingPipeline withExecutor(ExecutorService executor);

    public CallingPipeline call();

    public CallingPipeline join();

    public CallingState getState();

    // public CallingPipeline ifExceptional(Consumer handler);

    // public CallingPipeline ifExceptional(Function handler);

    public V get() throws Exception;

    public V getUnchecked();

    public  CallingPipeline then(OneArgCallable handler);

    public CallingPipeline thenPassive(OneArgNoReturnCallable handler);

    public CallingPipeline ifExceptional(BiPredicate handler);

    public CallingPipeline ifExceptionalPassive(BiConsumer handler);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy