2 * Copyright (c) 2010-2024 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.nibeuplink.internal.handler;
15 import java.util.List;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.eclipse.jetty.client.HttpClient;
20 import org.openhab.core.thing.Channel;
21 import org.openhab.core.thing.ChannelGroupUID;
22 import org.openhab.core.thing.ChannelUID;
23 import org.openhab.core.thing.Thing;
26 * generic implementation of handler logic
28 * @author Alexander Friese - initial contribution
31 public class GenericHandler extends UplinkBaseHandler {
34 * constructor, called by the factory
36 * @param thing instance of the thing, passed in by the factory
37 * @param httpClient the httpclient that communicates with the API
39 public GenericHandler(Thing thing, HttpClient httpClient) {
40 super(thing, httpClient);
44 public @Nullable Channel getSpecificChannel(String channelId) {
45 Channel channel = getThing().getChannel(channelId);
46 if (channel == null) {
47 for (ChannelGroupUID channelGroupUID : getRegisteredGroups()) {
48 channel = getThing().getChannel(new ChannelUID(channelGroupUID, channelId));
49 if (channel != null) {
58 public List<Channel> getChannels() {
59 return getThing().getChannels();