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 reference to a callback on an Object instance that takes Configuration type as argument. |
| 7 | * For more informations about configuration type, please refer to {@link CbConfiguration}. |
| 8 | * |
| 9 | * <p> The T generic parameter represents the type of the configuration class passed to the callback argument. |
| 10 | * |
| 11 | * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a> |
| 12 | */ |
| 13 | @FunctionalInterface |
| 14 | public interface InstanceCbConfiguration<T> extends SerializableLambda { |
| 15 | /** |
| 16 | * Handles the given argument. |
| 17 | * @param configType the configuration type |
| 18 | */ |
| 19 | void accept(T configType); |
| 20 | |
| 21 | default InstanceCbConfiguration<T> andThen(InstanceCbConfiguration<T> after) { |
| 22 | Objects.requireNonNull(after); |
| 23 | return (T configProxy) -> { |
| 24 | accept(configProxy); |
| 25 | after.accept(configProxy); |
| 26 | }; |
| 27 | } |
| 28 | } |