]> git.basschouten.com Git - openhab-addons.git/blob
f80316d61145ed9ad9cd96288989448971f9b619
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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 org.openhab.binding.unifi.internal.api.model.UniFiSite;
16
17 /**
18  * The {@link UniFiSiteCache} is a specific implementation of {@link UniFiCache} for the purpose of caching
19  * {@link UniFiSite} instances.
20  *
21  * The cache uses the following prefixes: <code>id</code>, <code>name</code>, <code>desc</code>
22  *
23  * @author Matthew Bowman - Initial contribution
24  */
25 public class UniFiSiteCache extends UniFiCache<UniFiSite> {
26
27     public UniFiSiteCache() {
28         super(PREFIX_ID, PREFIX_NAME, PREFIX_DESC);
29     }
30
31     @Override
32     protected String getSuffix(UniFiSite site, String prefix) {
33         switch (prefix) {
34             case PREFIX_ID:
35                 return site.getId();
36             case PREFIX_NAME:
37                 return site.getName();
38             case PREFIX_DESC:
39                 return site.getDescription();
40         }
41         return null;
42     }
43 }