]> git.basschouten.com Git - openhab-addons.git/blob
22e7d183b7647d698ae045ca1506421a5391f9e1
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.sensibo.internal;
14
15 import java.util.Collection;
16 import java.util.Collections;
17 import java.util.Locale;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
21 import org.openhab.binding.sensibo.internal.handler.SensiboSkyHandler;
22 import org.openhab.core.thing.binding.ThingHandler;
23 import org.openhab.core.thing.binding.ThingHandlerService;
24 import org.openhab.core.thing.type.ChannelGroupType;
25 import org.openhab.core.thing.type.ChannelGroupTypeProvider;
26 import org.openhab.core.thing.type.ChannelGroupTypeUID;
27 import org.openhab.core.thing.type.ChannelType;
28 import org.openhab.core.thing.type.ChannelTypeProvider;
29 import org.openhab.core.thing.type.ChannelTypeUID;
30
31 /**
32  * Channel Type Provider that does a callback the SensiboSkyHandler that initiated it.
33  *
34  * @author Arne Seime - Initial contribution
35  */
36 @NonNullByDefault
37 public class CallbackChannelsTypeProvider
38         implements ChannelTypeProvider, ChannelGroupTypeProvider, ThingHandlerService {
39     private @NonNullByDefault({}) SensiboSkyHandler handler;
40
41     @Override
42     public Collection<ChannelType> getChannelTypes(@Nullable final Locale locale) {
43         return handler.getChannelTypes(locale);
44     }
45
46     @Override
47     public @Nullable ChannelType getChannelType(final ChannelTypeUID channelTypeUID, @Nullable final Locale locale) {
48         return handler.getChannelType(channelTypeUID, locale);
49     }
50
51     @Override
52     public @Nullable ChannelGroupType getChannelGroupType(final ChannelGroupTypeUID channelGroupTypeUID,
53             @Nullable final Locale locale) {
54         return null;
55     }
56
57     @Override
58     public Collection<ChannelGroupType> getChannelGroupTypes(@Nullable final Locale locale) {
59         return Collections.emptyList();
60     }
61
62     @Override
63     @Nullable
64     public ThingHandler getThingHandler() {
65         return handler;
66     }
67
68     @NonNullByDefault({})
69     @Override
70     public void setThingHandler(final ThingHandler handler) {
71         this.handler = (SensiboSkyHandler) handler;
72     }
73 }