blob: f84c71b8ac5b5f5406dd38d6eec2e2a0f193405c [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
6import org.apache.felix.dm.Component;
7
8/**
9 * Represents a callback(Component, Dictionary) that is invoked on a Component implementation class.
10 * The type of the class on which the callback is invoked on is represented by the T generic parameter.
11 *
12 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
13 */
14@FunctionalInterface
15public interface CbTypeComponentDictionary<T> extends SerializableLambda {
16 /**
17 * Handles the given arguments.
18 * @param instance the Component implementation instance on which the callback is invoked on.
19 * @param component the first callback parameter
20 * @param conf the second callback parameter
21 */
22 void accept(T instance, Component component, Dictionary<String, Object> conf);
23
24 default CbTypeComponentDictionary<T> andThen(CbTypeComponentDictionary<? super T> after) {
25 Objects.requireNonNull(after);
26 return (T instance, Component component, Dictionary<String, Object> conf) -> {
27 accept(instance, component, conf);
28 after.accept(instance, component, conf);
29 };
30 }
31}