blob: 5049a253ed1fc5c6b8cfdcedeece903a637026aa [file] [log] [blame]
Pierre De Ropfaca2892016-01-31 23:27:05 +00001package org.apache.felix.dm.lambda.callbacks;
2
3import java.util.Objects;
4
5import org.apache.felix.dm.Component;
6import org.osgi.framework.Bundle;
7
8/**
9 * Represents a callback(Component, Bundle) on an Object instance.
10 *
11 * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
12 */
13@FunctionalInterface
14public interface CbComponentBundle {
15 /**
16 * Handles the given arguments.
17 * @param component the callback parameter
18 * @param bundle the callback parameter
19 */
20 void accept(Component component, Bundle bundle);
21
22 default CbComponentBundle andThen(CbComponentBundle after) {
23 Objects.requireNonNull(after);
24 return (Component component, Bundle bundle) -> {
25 accept(component, bundle);
26 after.accept(component, bundle);
27 };
28 }
29}