]> git.basschouten.com Git - openhab-addons.git/blob
53512ebf967b9d2dfcc3d2bfebd17cc76b1360de
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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;
14
15 import java.util.List;
16
17 /**
18  *
19  * @author Q42 - Initial contribution
20  * @author Denis Dudnik - moved Jue library source code inside the smarthome Hue binding
21  */
22 @SuppressWarnings("unused")
23 class SetAttributesRequest {
24     private String name;
25     private List<String> lights;
26
27     public SetAttributesRequest(String name) {
28         this(name, null);
29     }
30
31     public SetAttributesRequest(List<HueObject> lights) {
32         this(null, lights);
33     }
34
35     public SetAttributesRequest(String name, List<HueObject> lights) {
36         if (name != null && Util.stringSize(name) > 32) {
37             throw new IllegalArgumentException("Name can be at most 32 characters long");
38         } else if (lights != null && (lights.isEmpty() || lights.size() > 16)) {
39             throw new IllegalArgumentException("Group cannot be empty and cannot have more than 16 lights");
40         }
41
42         this.name = name;
43         if (lights != null) {
44             this.lights = Util.lightsToIds(lights);
45         }
46     }
47 }