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 | /** |
| 6 | * Represents a method reference to a no-args callback method from an arbitrary Object instance. |
| 7 | * |
| 8 | * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a> |
| 9 | */ |
| 10 | @FunctionalInterface |
| 11 | public interface InstanceCb { |
| 12 | /** |
| 13 | * Implements the callback method. |
| 14 | */ |
| 15 | void cb(); |
| 16 | |
| 17 | default InstanceCb andThen(InstanceCb after) { |
| 18 | Objects.requireNonNull(after); |
| 19 | return () -> { |
| 20 | cb(); |
| 21 | after.cb(); |
| 22 | }; |
| 23 | } |
| 24 | } |