]> git.basschouten.com Git - openhab-addons.git/blob
2bc9104c24c4744b29059dc2721f12fed8271b16
[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.MAC;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.unifi.internal.api.dto.UniFiDevice;
20
21 /**
22  * The {@link UniFiDeviceCache} is a specific implementation of {@link UniFiCache} for the purpose of caching
23  * {@link UniFiDevice} instances.
24  *
25  * The cache uses the following prefixes: <code>mac</code>
26  *
27  * @author Matthew Bowman - Initial contribution
28  */
29 @NonNullByDefault
30 class UniFiDeviceCache extends UniFiCache<UniFiDevice> {
31
32     public UniFiDeviceCache() {
33         super(MAC);
34     }
35
36     @Override
37     protected @Nullable String getSuffix(final UniFiDevice device, final Prefix prefix) {
38         switch (prefix) {
39             case MAC:
40                 return device.getMac();
41             default:
42                 return null;
43         }
44     }
45 }