]> git.basschouten.com Git - openhab-addons.git/blob
0ef81addd0a698ef8958b2526f684b873611ddb9
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.mqtt.homeassistant.internal.listener;
14
15 import org.eclipse.jdt.annotation.NonNull;
16 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import org.openhab.binding.mqtt.generic.ChannelStateUpdateListener;
18 import org.openhab.core.thing.ChannelUID;
19 import org.openhab.core.types.Command;
20 import org.openhab.core.types.State;
21
22 /**
23  * A proxy class for {@link ChannelStateUpdateListener} forwarding everything to the real listener.
24  * <p>
25  * This class is used to be able handle special cases like timeouts.
26  *
27  * @author Jochen Klein - Initial contribution
28  */
29 @NonNullByDefault
30 public abstract class ChannelStateUpdateListenerProxy implements ChannelStateUpdateListener {
31
32     private final ChannelStateUpdateListener original;
33
34     public ChannelStateUpdateListenerProxy(ChannelStateUpdateListener original) {
35         this.original = original;
36     }
37
38     @Override
39     public void updateChannelState(@NonNull ChannelUID channelUID, @NonNull State value) {
40         original.updateChannelState(channelUID, value);
41     }
42
43     @Override
44     public void postChannelCommand(@NonNull ChannelUID channelUID, @NonNull Command value) {
45         original.postChannelCommand(channelUID, value);
46     }
47
48     @Override
49     public void triggerChannel(@NonNull ChannelUID channelUID, @NonNull String eventPayload) {
50         original.triggerChannel(channelUID, eventPayload);
51     }
52 }