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.freeathomesystem.internal.type;
15 import java.util.Collection;
16 import java.util.HashMap;
17 import java.util.Locale;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.core.thing.ThingTypeUID;
23 import org.openhab.core.thing.binding.ThingTypeProvider;
24 import org.openhab.core.thing.type.ThingType;
25 import org.osgi.service.component.annotations.Component;
29 * @author Andras Uhrin - Initial contribution
33 @Component(service = { FreeAtHomeThingTypeProvider.class, ThingTypeProvider.class })
35 public class FreeAtHomeThingTypeProviderImpl implements FreeAtHomeThingTypeProvider {
36 private final Map<ThingTypeUID, ThingType> thingTypesByUID = new HashMap<>();
39 public Collection<ThingType> getThingTypes(@Nullable Locale locale) {
40 Map<ThingTypeUID, ThingType> copy = new HashMap<>(thingTypesByUID);
45 public @Nullable ThingType getThingType(ThingTypeUID thingTypeUID, @Nullable Locale locale) {
46 return thingTypesByUID.get(thingTypeUID);
50 public void addThingType(@Nullable ThingType thingType) {
51 if (thingType != null) {
52 thingTypesByUID.put(thingType.getUID(), thingType);