]> git.basschouten.com Git - openhab-addons.git/blob
2e29b90508261a48be185a4e11bb6ac2685fc59b
[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 /**
16  *
17  * @author Q42 - Initial contribution
18  * @author Denis Dudnik - moved Jue library source code inside the smarthome Hue binding
19  */
20 @SuppressWarnings("unused")
21 public class CreateUserRequest {
22     private String username;
23     private String devicetype;
24
25     public CreateUserRequest(String username, String devicetype) {
26         if (Util.stringSize(devicetype) > 40) {
27             throw new IllegalArgumentException("Device type can be at most 40 characters long");
28         }
29
30         if (Util.stringSize(username) < 10 || Util.stringSize(username) > 40) {
31             throw new IllegalArgumentException("Username must be between 10 and 40 characters long");
32         }
33
34         this.username = username;
35         this.devicetype = devicetype;
36     }
37
38     public CreateUserRequest(String devicetype) {
39         if (Util.stringSize(devicetype) > 40) {
40             throw new IllegalArgumentException("Device type can be at most 40 characters long");
41         }
42
43         this.devicetype = devicetype;
44     }
45 }