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.Objects; |
| 4 | |
| 5 | import org.osgi.framework.Bundle; |
| 6 | |
| 7 | /** |
| 8 | * Represents a callback(Bundle) on an Object instance. |
| 9 | * |
| 10 | * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a> |
| 11 | */ |
| 12 | @FunctionalInterface |
| 13 | public interface InstanceCbBundle extends SerializableLambda { |
| 14 | /** |
| 15 | * Handles the given argument. |
| 16 | * @param bundle the callback parameter |
| 17 | */ |
| 18 | void accept(Bundle bundle); |
| 19 | |
| 20 | default InstanceCbBundle andThen(InstanceCbBundle after) { |
| 21 | Objects.requireNonNull(after); |
| 22 | return (Bundle bundle) -> { |
| 23 | accept(bundle); |
| 24 | after.accept(bundle); |
| 25 | }; |
| 26 | } |
| 27 | } |