2 * Copyright (c) 2010-2023 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.hdpowerview.internal.builders;
15 import java.util.ArrayList;
16 import java.util.List;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
21 import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
22 import org.openhab.core.thing.Channel;
23 import org.openhab.core.thing.ChannelGroupUID;
24 import org.openhab.core.thing.type.ChannelTypeUID;
27 * The {@link BaseChannelBuilder} class is super class for
30 * @author Jacob Laursen - Initial contribution
33 public class BaseChannelBuilder {
35 protected final HDPowerViewTranslationProvider translationProvider;
36 protected final ChannelGroupUID channelGroupUid;
37 protected final ChannelTypeUID channelTypeUid;
40 protected List<Channel> channels;
42 protected BaseChannelBuilder(HDPowerViewTranslationProvider translationProvider, ChannelGroupUID channelGroupUid,
43 String channelTypeId) {
44 this.translationProvider = translationProvider;
45 this.channelGroupUid = channelGroupUid;
46 this.channelTypeUid = new ChannelTypeUID(HDPowerViewBindingConstants.BINDING_ID, channelTypeId);
49 protected List<Channel> getChannelList(int initialCapacity) {
50 List<Channel> channels = this.channels;
51 return channels != null ? channels : new ArrayList<>(initialCapacity);