FELIX-4689: Create a more fluent syntax for the dependency manager builder.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1727869 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefService.java b/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefService.java
new file mode 100644
index 0000000..ca795f4
--- /dev/null
+++ b/dependencymanager/org.apache.felix.dependencymanager.lambda/src/org/apache/felix/dm/lambda/callbacks/CbRefService.java
@@ -0,0 +1,28 @@
+package org.apache.felix.dm.lambda.callbacks;
+
+import java.util.Objects;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Represents a callback(ServiceReference, Service) on an Object instance.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@FunctionalInterface
+public interface CbRefService<S> {
+ /**
+ * Handles the given arguments.
+ * @param ref a Service Reference
+ * @param service a Service
+ */
+ void accept(ServiceReference<S> ref, S service);
+
+ default CbRefService<S> andThen(CbRefService<S> after) {
+ Objects.requireNonNull(after);
+ return (ServiceReference<S> ref, S service) -> {
+ accept(ref, service);
+ after.accept(ref, service);
+ };
+ }
+}