]> git.basschouten.com Git - openhab-addons.git/blob
7fea44816fa0b095c399a1a1f21b3e9f2afdc08e
[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.hue.internal.dto;
14
15 import java.util.Date;
16
17 /**
18  * Collection of updates to a schedule.
19  *
20  * @author Q42 - Initial contribution
21  * @author Denis Dudnik - moved Jue library source code inside the smarthome Hue binding, minor code cleanup
22  * @author Samuel Leisering - refactor configuration updates
23  */
24 public class ScheduleUpdate extends ConfigUpdate {
25
26     /**
27      * Set the name of the schedule.
28      *
29      * @param name new name
30      * @return this object for chaining calls
31      */
32     public ScheduleUpdate setName(String name) {
33         if (Util.stringSize(name) > 32) {
34             throw new IllegalArgumentException("Schedule name can be at most 32 characters long");
35         }
36
37         commands.add(new Command("name", name));
38         return this;
39     }
40
41     /**
42      * Set the description of the schedule.
43      *
44      * @param description new description
45      * @return this object for chaining calls
46      */
47     public ScheduleUpdate setDescription(String description) {
48         if (Util.stringSize(description) > 64) {
49             throw new IllegalArgumentException("Schedule description can be at most 64 characters long");
50         }
51
52         commands.add(new Command("description", description));
53         return this;
54     }
55
56     /**
57      * Set the time of the schedule.
58      *
59      * @param time new time
60      * @return this object for chaining calls
61      */
62     public ScheduleUpdate setTime(Date time) {
63         commands.add(new Command("time", time));
64         return this;
65     }
66 }