]> git.basschouten.com Git - openhab-addons.git/blob
3b9f1e6bef537aecbe44d0934e25bcc5ad1f6ca3
[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.squeezebox.internal.model;
14
15 /**
16  * Attributes of a Squeezebox Server favorite
17  *
18  * @author Mark Hilbush - Initial contribution
19  *
20  */
21 public class Favorite {
22     /**
23      * Favorite id is of form xxxxxxxx.nn
24      */
25     public String id;
26
27     /**
28      * Just the nn part of the id
29      */
30     public String shortId;
31
32     /**
33      * The name given to the favorite in the Squeezebox Server.
34      */
35     public String name;
36
37     /**
38      * Creates a preset from the given favorite id
39      *
40      * @param id Squeezebox Server internal identifier for favorite
41      */
42     public Favorite(String id) {
43         this.id = id;
44         this.shortId = id;
45         if (id.indexOf(".") != -1) {
46             this.shortId = id.substring(id.indexOf(".") + 1);
47         }
48     }
49
50     @Override
51     public String toString() {
52         StringBuilder sb = new StringBuilder();
53         sb.append("Favorite {id=").append(id).append(", shortId=").append(shortId).append(", name=").append(name)
54                 .append("}");
55         return sb.toString();
56     }
57 }