blob: ea54a102855062d1ccaf4376fddeb48fdaba0d7f [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/**
Pierre De Rop57ffa3f2016-02-19 12:54:30 +00008 * Represents a callback(Component) invoked on an Object instance.
Pierre De Rop11527502016-02-18 21:07:16 +00009 *
10 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
11 */
12@FunctionalInterface
13public interface InstanceCbComponent {
14 /**
15 * Handles the given argument.
16 * @param component the callback parameter
17 */
18 void accept(Component component);
19
20 default InstanceCbComponent andThen(InstanceCbComponent after) {
21 Objects.requireNonNull(after);
22 return (Component component) -> {
23 accept(component);
24 after.accept(component);
25 };
26 }
27}