blob: 8d4ceb18398cde4b18a0155668983fbbb7c6d153 [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(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 CbTypeDictionary<T> extends SerializableLambda {
14 /**
15 * Handles the given arguments.
16 * @param instance the Component implementation instance on which the callback is invoked on.
17 * @param conf first callback param
18 */
19 void accept(T instance, Dictionary<String, Object> conf);
20
21 default CbTypeDictionary<T> andThen(CbTypeDictionary<? super T> after) {
22 Objects.requireNonNull(after);
23 return (T instance, Dictionary<String, Object> conf) -> {
24 accept(instance, conf);
25 after.accept(instance, conf);
26 };
27 }
28}