]> git.basschouten.com Git - openhab-addons.git/blob
a866995d17312464f15b0a85ce9287a5d95c504c
[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.pulseaudio.internal.items;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * Abstract root class for all items in a pulseaudio server. Every item in a
19  * pulseaudio server has a name and a unique id which can be inherited by this
20  * class.
21  *
22  * @author Tobias Bräutigam - Initial contribution
23  */
24 @NonNullByDefault
25 public abstract class AbstractDeviceConfig {
26
27     protected int id;
28     protected String name;
29
30     public AbstractDeviceConfig(int id, String name) {
31         this.id = id;
32         this.name = name;
33     }
34
35     /**
36      * returns the internal id of this device
37      *
38      * @return
39      */
40     public int getId() {
41         return id;
42     }
43
44     public String getUIDName() {
45         return name.replaceAll("[^A-Za-z0-9_]", "_");
46     }
47
48     public String getPaName() {
49         return name;
50     }
51 }