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