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.automation.pidcontroller.internal.type;
15 import java.util.Collection;
16 import java.util.Collections;
17 import java.util.Locale;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.automation.pidcontroller.internal.handler.PIDControllerTriggerHandler;
23 import org.openhab.core.automation.type.ModuleType;
24 import org.openhab.core.automation.type.ModuleTypeProvider;
25 import org.openhab.core.common.registry.ProviderChangeListener;
26 import org.osgi.service.component.annotations.Component;
30 * @author Hilbrand Bouwkamp - Initial Contribution
34 public class PIDControllerModuleTypeProvider implements ModuleTypeProvider {
35 private static final Map<String, ModuleType> PROVIDED_MODULE_TYPES = Map
36 .of(PIDControllerTriggerHandler.MODULE_TYPE_ID, PIDControllerTriggerType.initialize());
38 @SuppressWarnings("unchecked")
40 public <T extends ModuleType> T getModuleType(@Nullable String UID, @Nullable Locale locale) {
41 return (T) PROVIDED_MODULE_TYPES.get(UID);
44 @SuppressWarnings("unchecked")
46 public <T extends ModuleType> Collection<T> getModuleTypes(@Nullable Locale locale) {
47 return (Collection<T>) PROVIDED_MODULE_TYPES.values();
51 public void addProviderChangeListener(ProviderChangeListener<ModuleType> listener) {
52 // does nothing because this provider does not change
56 public Collection<ModuleType> getAll() {
57 return Collections.unmodifiableCollection(PROVIDED_MODULE_TYPES.values());
61 public void removeProviderChangeListener(ProviderChangeListener<ModuleType> listener) {
62 // does nothing because this provider does not change