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.tacmi.internal;
15 import java.util.Collection;
16 import java.util.Collections;
17 import java.util.HashMap;
18 import java.util.Locale;
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.eclipse.jdt.annotation.Nullable;
23 import org.openhab.core.thing.type.ChannelType;
24 import org.openhab.core.thing.type.ChannelTypeProvider;
25 import org.openhab.core.thing.type.ChannelTypeUID;
26 import org.osgi.service.component.annotations.Component;
29 * Provides all ChannelTypes for the schema binding...
31 * @author Christian Niessner - Initial contribution
34 @Component(service = { TACmiChannelTypeProvider.class, ChannelTypeProvider.class })
35 public class TACmiChannelTypeProvider implements ChannelTypeProvider {
37 private final Map<ChannelTypeUID, ChannelType> channelTypesByUID = new HashMap<>();
40 public Collection<ChannelType> getChannelTypes(@Nullable Locale locale) {
41 return Collections.unmodifiableCollection(channelTypesByUID.values());
45 public @Nullable ChannelType getChannelType(ChannelTypeUID channelTypeUID, @Nullable Locale locale) {
46 return channelTypesByUID.get(channelTypeUID);
49 public @Nullable ChannelType getInternalChannelType(ChannelTypeUID channelTypeUID) {
50 return channelTypesByUID.get(channelTypeUID);
53 public void addChannelType(ChannelType channelType) {
54 channelTypesByUID.put(channelType.getUID(), channelType);