Pierre De Rop | 1152750 | 2016-02-18 21:07:16 +0000 | [diff] [blame^] | 1 | package org.apache.felix.dm.lambda.callbacks; |
| 2 | |
| 3 | import java.util.Dictionary; |
| 4 | import java.util.Objects; |
| 5 | |
| 6 | import org.apache.felix.dm.Component; |
| 7 | |
| 8 | /** |
| 9 | * Represents a callback(Dictionary, Component) on an Object instance. |
| 10 | * |
| 11 | * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a> |
| 12 | */ |
| 13 | @FunctionalInterface |
| 14 | public interface InstanceCbDictionaryComponent { |
| 15 | /** |
| 16 | * Handles the given arguments. |
| 17 | * @param properties some service properties |
| 18 | * @param component a Component |
| 19 | */ |
| 20 | void accept(Dictionary<String, Object> properties, Component component); |
| 21 | |
| 22 | default InstanceCbDictionaryComponent andThen(InstanceCbDictionaryComponent after) { |
| 23 | Objects.requireNonNull(after); |
| 24 | return (Dictionary<String, Object> properties, Component component) -> { |
| 25 | accept(properties, component); |
| 26 | after.accept(properties, component); |
| 27 | }; |
| 28 | } |
| 29 | } |