]> git.basschouten.com Git - openhab-addons.git/blob
6cbe4d11219027b11d682d5406d563de6dc8ceca
[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.sleepiq.internal.api.dto;
14
15 /**
16  * The {@link LoginRequest} holds the Login request sent to the sleepiq API.
17  *
18  * @author Gregory Moyer - Initial contribution
19  */
20 public class LoginRequest {
21     private String login;
22     private String password;
23
24     public String getLogin() {
25         return login;
26     }
27
28     public void setLogin(String login) {
29         this.login = login;
30     }
31
32     public LoginRequest withLogin(String login) {
33         setLogin(login);
34         return this;
35     }
36
37     public String getPassword() {
38         return password;
39     }
40
41     public void setPassword(String password) {
42         this.password = password;
43     }
44
45     public LoginRequest withPassword(String password) {
46         setPassword(password);
47         return this;
48     }
49
50     @Override
51     public int hashCode() {
52         final int prime = 31;
53         int result = 1;
54         result = prime * result + ((login == null) ? 0 : login.hashCode());
55         result = prime * result + ((password == null) ? 0 : password.hashCode());
56         return result;
57     }
58
59     @Override
60     public boolean equals(Object obj) {
61         if (this == obj) {
62             return true;
63         }
64         if (obj == null) {
65             return false;
66         }
67         if (!(obj instanceof LoginRequest)) {
68             return false;
69         }
70         LoginRequest other = (LoginRequest) obj;
71         if (login == null) {
72             if (other.login != null) {
73                 return false;
74             }
75         } else if (!login.equals(other.login)) {
76             return false;
77         }
78         if (password == null) {
79             if (other.password != null) {
80                 return false;
81             }
82         } else if (!password.equals(other.password)) {
83             return false;
84         }
85         return true;
86     }
87
88     @Override
89     public String toString() {
90         StringBuilder builder = new StringBuilder();
91         builder.append("LoginRequest [login=");
92         builder.append(login);
93         builder.append(", password=");
94         builder.append(password);
95         builder.append("]");
96         return builder.toString();
97     }
98 }