]> git.basschouten.com Git - openhab-addons.git/blob
4b8fc03a5e5d6482c4501c2c802ea046b095c784
[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.binding.unifi.internal.api.cache;
14
15 import static org.openhab.binding.unifi.internal.api.cache.UniFiCache.Prefix.ID;
16 import static org.openhab.binding.unifi.internal.api.cache.UniFiCache.Prefix.NAME;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.unifi.internal.api.dto.UniFiWlan;
21
22 /**
23  * The {@link UniFiWlanCache} is a specific implementation of {@link UniFiCache} for the purpose of caching
24  * {@link UniFiWlan} instances.
25  *
26  * The cache uses the following prefixes: <code>id</code>, <code>name</code>
27  *
28  * @author Hilbrand Bouwkamp - Initial contribution
29  */
30 @NonNullByDefault
31 class UniFiWlanCache extends UniFiCache<UniFiWlan> {
32
33     public UniFiWlanCache() {
34         super(ID, NAME);
35     }
36
37     @Override
38     protected @Nullable String getSuffix(final UniFiWlan wlan, final Prefix prefix) {
39         switch (prefix) {
40             case ID:
41                 return wlan.getId();
42             case NAME:
43                 return wlan.getName();
44             default:
45                 return null;
46         }
47     }
48 }