]> git.basschouten.com Git - openhab-addons.git/blob
d0e42d127ed9ddd802d937bc342a0a2e15deac8c
[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.bticinosmarther.internal.api.dto;
14
15 import static org.openhab.binding.bticinosmarther.internal.SmartherBindingConstants.DEFAULT_PROGRAM;
16
17 /**
18  * The {@code Program} class defines the dto for Smarther API program object.
19  *
20  * @author Fabio Possieri - Initial contribution
21  */
22 public class Program {
23
24     private int number;
25     private String name;
26
27     /**
28      * Returns the program number.
29      *
30      * @return the program number
31      */
32     public int getNumber() {
33         return number;
34     }
35
36     /**
37      * Returns the program reference label (i.e. the program "name").
38      *
39      * @return a string containing the program reference label
40      */
41     public String getName() {
42         return (number == 0) ? DEFAULT_PROGRAM : name;
43     }
44
45     @Override
46     public String toString() {
47         return String.format("number=%d, name=%s", number, name);
48     }
49 }