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