]> git.basschouten.com Git - openhab-addons.git/blob
19faf866c67a47721f42d212bd7aee4a4fbf8349
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.transform.rollershutterposition.internal;
14
15 import static org.openhab.transform.rollershutterposition.internal.RollerShutterPositionConstants.PROFILE_TYPE_UID;
16
17 import java.util.Collection;
18 import java.util.List;
19 import java.util.Locale;
20
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;
33
34 /**
35  * {@link RollerShutterPositionProfileFactory} Factory to create the profile
36  *
37  * @author Jeff James - Initial contribution
38  */
39 @NonNullByDefault
40 @Component(service = { ProfileFactory.class, ProfileTypeProvider.class })
41 public class RollerShutterPositionProfileFactory implements ProfileFactory, ProfileTypeProvider {
42     @Override
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());
46     }
47
48     @Override
49     public @Nullable Profile createProfile(ProfileTypeUID profileTypeUID, ProfileCallback callback,
50             ProfileContext profileContext) {
51         return new RollerShutterPositionProfile(callback, profileContext);
52     }
53
54     @Override
55     public Collection<ProfileTypeUID> getSupportedProfileTypeUIDs() {
56         return List.of(PROFILE_TYPE_UID);
57     }
58 }