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.transform.rollershutterposition.internal;
15 import static org.openhab.transform.rollershutterposition.internal.RollerShutterPositionConstants.PROFILE_TYPE_UID;
17 import java.util.Collection;
18 import java.util.List;
19 import java.util.Locale;
21 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import org.eclipse.jdt.annotation.Nullable;
23 import org.openhab.core.library.CoreItemFactory;
24 import org.openhab.core.thing.profiles.Profile;
25 import org.openhab.core.thing.profiles.ProfileCallback;
26 import org.openhab.core.thing.profiles.ProfileContext;
27 import org.openhab.core.thing.profiles.ProfileFactory;
28 import org.openhab.core.thing.profiles.ProfileType;
29 import org.openhab.core.thing.profiles.ProfileTypeBuilder;
30 import org.openhab.core.thing.profiles.ProfileTypeProvider;
31 import org.openhab.core.thing.profiles.ProfileTypeUID;
32 import org.osgi.service.component.annotations.Component;
35 * {@link RollerShutterPositionProfileFactory} Factory to create the profile
37 * @author Jeff James - Initial contribution
40 @Component(service = { ProfileFactory.class, ProfileTypeProvider.class })
41 public class RollerShutterPositionProfileFactory implements ProfileFactory, ProfileTypeProvider {
43 public Collection<ProfileType> getProfileTypes(@Nullable Locale locale) {
44 return List.of(ProfileTypeBuilder.newState(PROFILE_TYPE_UID, PROFILE_TYPE_UID.getId())
45 .withSupportedItemTypes(CoreItemFactory.ROLLERSHUTTER).build());
49 public @Nullable Profile createProfile(ProfileTypeUID profileTypeUID, ProfileCallback callback,
50 ProfileContext profileContext) {
51 return new RollerShutterPositionProfile(callback, profileContext);
55 public Collection<ProfileTypeUID> getSupportedProfileTypeUIDs() {
56 return List.of(PROFILE_TYPE_UID);