2 * Copyright 2017 Gregory Moyer
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openhab.binding.sleepiq.api.model;
18 import com.google.gson.annotations.SerializedName;
20 public class BedSideStatus
22 @SerializedName("isInBed")
23 private Boolean inBed;
24 private String alertDetailedMessage;
25 private Integer sleepNumber;
27 private TimeSince lastLink;
28 private Integer pressure; // appears to be in kPa
30 public Boolean isInBed()
35 public void setInBed(Boolean inBed)
40 public BedSideStatus withInBed(Boolean inBed)
46 public String getAlertDetailedMessage()
48 return alertDetailedMessage;
51 public void setAlertDetailedMessage(String alertDetailedMessage)
53 this.alertDetailedMessage = alertDetailedMessage;
56 public BedSideStatus withAlertDetailedMessage(String alertDetailedMessage)
58 setAlertDetailedMessage(alertDetailedMessage);
62 public Integer getSleepNumber()
67 public void setSleepNumber(Integer sleepNumber)
69 this.sleepNumber = sleepNumber;
72 public BedSideStatus withSleepNumber(Integer sleepNumber)
74 setSleepNumber(sleepNumber);
78 public Long getAlertId()
83 public void setAlertId(Long alertId)
85 this.alertId = alertId;
88 public BedSideStatus withAlertId(Long alertId)
94 public TimeSince getLastLink()
99 public void setLastLink(TimeSince lastLink)
101 this.lastLink = lastLink;
104 public BedSideStatus withLastLink(TimeSince lastLink)
106 setLastLink(lastLink);
110 public Integer getPressure()
115 public void setPressure(Integer pressure)
117 this.pressure = pressure;
120 public BedSideStatus withPressure(Integer pressure)
122 setPressure(pressure);
127 public int hashCode()
129 final int prime = 31;
131 result = prime * result
132 + ((alertDetailedMessage == null) ? 0 : alertDetailedMessage.hashCode());
133 result = prime * result + ((alertId == null) ? 0 : alertId.hashCode());
134 result = prime * result + ((inBed == null) ? 0 : inBed.hashCode());
135 result = prime * result + ((lastLink == null) ? 0 : lastLink.hashCode());
136 result = prime * result + ((pressure == null) ? 0 : pressure.hashCode());
137 result = prime * result + ((sleepNumber == null) ? 0 : sleepNumber.hashCode());
142 public boolean equals(Object obj)
152 if (!(obj instanceof BedSideStatus))
156 BedSideStatus other = (BedSideStatus)obj;
157 if (alertDetailedMessage == null)
159 if (other.alertDetailedMessage != null)
164 else if (!alertDetailedMessage.equals(other.alertDetailedMessage))
170 if (other.alertId != null)
175 else if (!alertId.equals(other.alertId))
181 if (other.inBed != null)
186 else if (!inBed.equals(other.inBed))
190 if (lastLink == null)
192 if (other.lastLink != null)
197 else if (!lastLink.equals(other.lastLink))
201 if (pressure == null)
203 if (other.pressure != null)
208 else if (!pressure.equals(other.pressure))
212 if (sleepNumber == null)
214 if (other.sleepNumber != null)
219 else if (!sleepNumber.equals(other.sleepNumber))
227 public String toString()
229 StringBuilder builder = new StringBuilder();
230 builder.append("BedSideStatus [inBed=");
231 builder.append(inBed);
232 builder.append(", alertDetailedMessage=");
233 builder.append(alertDetailedMessage);
234 builder.append(", sleepNumber=");
235 builder.append(sleepNumber);
236 builder.append(", alertId=");
237 builder.append(alertId);
238 builder.append(", lastLink=");
239 builder.append(lastLink);
240 builder.append(", pressure=");
241 builder.append(pressure);
243 return builder.toString();