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

org.zalando.riptide.Completion Maven / Gradle / Ivy

package org.zalando.riptide;

import javax.annotation.Nullable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;

public interface Completion extends Future, CompletionStage {

    @Override
     Completion thenApply(Function fn);

    @Override
     Completion thenApplyAsync(Function fn);

    @Override
     Completion thenApplyAsync(Function fn, Executor executor);

    @Override
    Completion thenAccept(Consumer action);

    @Override
    Completion thenAcceptAsync(Consumer action);

    @Override
    Completion thenAcceptAsync(Consumer action, Executor executor);

    @Override
    Completion thenRun(Runnable action);

    @Override
    Completion thenRunAsync(Runnable action);

    @Override
    Completion thenRunAsync(Runnable action, Executor executor);

    @Override
     Completion thenCombine(CompletionStage other, BiFunction fn);

    @Override
     Completion thenCombineAsync(CompletionStage other, BiFunction fn);

    @Override
     Completion thenCombineAsync(CompletionStage other, BiFunction fn, Executor executor);

    @Override
     Completion thenAcceptBoth(CompletionStage other, BiConsumer action);

    @Override
     Completion thenAcceptBothAsync(CompletionStage other, BiConsumer action);

    @Override
     Completion thenAcceptBothAsync(CompletionStage other, BiConsumer action, Executor executor);

    @Override
    Completion runAfterBoth(CompletionStage other, Runnable action);

    @Override
    Completion runAfterBothAsync(CompletionStage other, Runnable action);

    @Override
    Completion runAfterBothAsync(CompletionStage other, Runnable action, Executor executor);

    @Override
     Completion applyToEither(CompletionStage other, Function fn);

    @Override
     Completion applyToEitherAsync(CompletionStage other, Function fn);

    @Override
     Completion applyToEitherAsync(CompletionStage other, Function fn, Executor executor);

    @Override
    Completion acceptEither(CompletionStage other, Consumer action);

    @Override
    Completion acceptEitherAsync(CompletionStage other, Consumer action);

    @Override
    Completion acceptEitherAsync(CompletionStage other, Consumer action, Executor executor);

    @Override
    Completion runAfterEither(CompletionStage other, Runnable action);

    @Override
    Completion runAfterEitherAsync(CompletionStage other, Runnable action);

    @Override
    Completion runAfterEitherAsync(CompletionStage other, Runnable action, Executor executor);

    @Override
     Completion thenCompose(Function> fn);

    @Override
     Completion thenComposeAsync(Function> fn);

    @Override
     Completion thenComposeAsync(Function> fn, Executor executor);

    @Override
    Completion exceptionally(Function fn);

    @Override
    Completion whenComplete(BiConsumer action);

    @Override
    Completion whenCompleteAsync(BiConsumer action);

    @Override
    Completion whenCompleteAsync(BiConsumer action, Executor executor);

    @Override
     Completion handle(BiFunction fn);

    @Override
     Completion handleAsync(BiFunction fn);

    @Override
     Completion handleAsync(BiFunction fn, Executor executor);

    T join() throws CancellationException, CompletionException;

    T getNow(@Nullable T valueIfAbsent) throws CancellationException, CompletionException;

    static  Completion valueOf(final CompletableFuture future) {
        return new CompletionAdapter<>(future);
    }

}