blob: 7ddbe5326e8420f48fb9008605da2ad70c72bfb8 [file] [log] [blame]
Pierre De Ropfaca2892016-01-31 23:27:05 +00001package org.apache.felix.dm.lambda.callbacks;
2
3import java.util.Objects;
4
5import org.apache.felix.dm.Component;
6
7/**
8 * Represents a callback(Component, Service) on an Object instance.
9 *
10 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
11 */
12@FunctionalInterface
13public interface CbComponentService<S> {
14 /**
15 * Handles the given arguments
16 * @param c the component
17 * @param service the service
18 */
19 void accept(Component c, S service);
20
21 default CbComponentService<S> andThen(CbComponentService<S> after) {
22 Objects.requireNonNull(after);
23 return (Component c, S service) -> {
24 accept(c, service);
25 after.accept(c, service);
26 };
27 }
28}