blob: f2b2662dd2f446da12ca459ce4ae4443fbdf104f [file] [log] [blame]
Pierre De Rop11527502016-02-18 21:07:16 +00001package org.apache.felix.dm.lambda.callbacks;
2
3import java.util.Objects;
4
5/**
6 * Represents a callback that accepts the result of a CompletableFuture. The callback is invoked on an Object instance.
7 *
8 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
9 */
10@FunctionalInterface
11public interface InstanceCbFuture<F> {
12 /**
13 * Handles the result of a CompletableFuture operation.
14 * @param future the result of a CompletableFuture operation.
15 */
16 void accept(F future);
17
18 default InstanceCbFuture<F> andThen(InstanceCbFuture<? super F> after) {
19 Objects.requireNonNull(after);
20 return (F f) -> {
21 accept(f);
22 after.accept(f);
23 };
24 }
25}