blob: 1e34dc02280af5abd854af381ac52997217a1219 [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) which accepts a configuration type for wrapping properties
9 * behind a dynamic proxy interface. For more informations about configuration type, please refer to {@link CbConfiguration}.
10 *
11 * <p> The T generic parameter represents the type of the class on which the callback is invoked on.
12 * <p> The U 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 CbConfigurationComponent<T, U> extends SerializableLambda {
18 /**
19 * Handles the given arguments
20 * @param instance the Component implementation instance on which the callback is invoked on.
21 * @param configuration the configuration proxy
22 * @param component the callback Component
23 */
24 void accept(T instance, U configuration, Component component);
25
26 default CbConfigurationComponent<T, U> andThen(CbConfigurationComponent<T, U> after) {
27 Objects.requireNonNull(after);
28 return (T instance, U configuration, Component component) -> {
29 accept(instance, configuration, component);
30 after.accept(instance, configuration, component);
31 };
32 }
33}