]> git.basschouten.com Git - openhab-addons.git/blob
7de2b016c68eee0428c47bad49d3336ff8a7351c
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.NonNullByDefault;
16 import org.openhab.binding.mqtt.generic.ChannelStateUpdateListener;
17 import org.openhab.core.thing.ChannelUID;
18 import org.openhab.core.types.Command;
19 import org.openhab.core.types.State;
20
21 /**
22  * A proxy class for {@link ChannelStateUpdateListener} forwarding everything to the real listener.
23  * <p>
24  * This class is used to be able handle special cases like timeouts.
25  *
26  * @author Jochen Klein - Initial contribution
27  */
28 @NonNullByDefault
29 public abstract class ChannelStateUpdateListenerProxy implements ChannelStateUpdateListener {
30
31     private final ChannelStateUpdateListener original;
32
33     public ChannelStateUpdateListenerProxy(ChannelStateUpdateListener original) {
34         this.original = original;
35     }
36
37     @Override
38     public void updateChannelState(ChannelUID channelUID, State value) {
39         original.updateChannelState(channelUID, value);
40     }
41
42     @Override
43     public void postChannelCommand(ChannelUID channelUID, Command value) {
44         original.postChannelCommand(channelUID, value);
45     }
46
47     @Override
48     public void triggerChannel(ChannelUID channelUID, String eventPayload) {
49         original.triggerChannel(channelUID, eventPayload);
50     }
51 }