blob: 01f518b1fe72aa139e06520d00faabc2ebe4780d [file] [log] [blame]
Pierre De Ropfaca2892016-01-31 23:27:05 +00001package org.apache.felix.dm.lambda.callbacks;
2
3import java.util.Objects;
4
5/**
6 * Represents a callback(Service) that is invoked on a Component implementation class.
7 * The type of the class on which the callback is invoked on is represented by the T generic parameter.
8 *
9 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
10 */
11@FunctionalInterface
12public interface CbTypeService<T, S> extends SerializableLambda {
13 /**
14 * Handles the given arguments.
15 * @param instance the Component implementation instance on which the callback is invoked on.
16 * @param service first callback param
17 */
18 void accept(T instance, S service);
19
20 default CbTypeFuture<T, S> andThen(CbTypeFuture<? super T, S> after) {
21 Objects.requireNonNull(after);
22 return (T instance, S service) -> {
23 accept(instance, service);
24 after.accept(instance, service);
25 };
26 }
27}