blob: 1feaea3c69023063eca094fecaa21bcfc0dca7d4 [file] [log] [blame]
Pierre De Rop11527502016-02-18 21:07:16 +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(Configuration, Component) that is invoked on a Component implementation class.
9 * The type of the class on which the callback is invoked on is represented by the T generic parameter.
10 * For more informations about configuration type, please refer to {@link CbConfiguration}.
11 *
12 * <p> The T generic parameter represents the type of the configuration class passed to the callback argument.
13 *
14 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
15 */
16@FunctionalInterface
17public interface InstanceCbConfigurationComponent<T> extends SerializableLambda {
18 /**
19 * Handles the given arguments
20 * @param instance the Component implementation instance on which the callback is invoked on.
21 * @param component the callback Component
22 */
23 void accept(T instance, Component component);
24
25 default InstanceCbConfigurationComponent<T> andThen(InstanceCbConfigurationComponent<T> after) {
26 Objects.requireNonNull(after);
27 return (T instance, Component component) -> {
28 accept(instance, component);
29 after.accept(instance, component);
30 };
31 }
32}