ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
TMBOY
Date:
Tue Jul 18 16:34:48 2017 +0800
Revision:
45:2aa9f933c8d2
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 45:2aa9f933c8d2 1 /*
TMBOY 45:2aa9f933c8d2 2 * Copyright (c) 2017 Baidu, Inc. All Rights Reserved.
TMBOY 45:2aa9f933c8d2 3 *
TMBOY 45:2aa9f933c8d2 4 * Licensed under the Apache License, Version 2.0 (the "License");
TMBOY 45:2aa9f933c8d2 5 * you may not use this file except in compliance with the License.
TMBOY 45:2aa9f933c8d2 6 * You may obtain a copy of the License at
TMBOY 45:2aa9f933c8d2 7 *
TMBOY 45:2aa9f933c8d2 8 * http://www.apache.org/licenses/LICENSE-2.0
TMBOY 45:2aa9f933c8d2 9 *
TMBOY 45:2aa9f933c8d2 10 * Unless required by applicable law or agreed to in writing, software
TMBOY 45:2aa9f933c8d2 11 * distributed under the License is distributed on an "AS IS" BASIS,
TMBOY 45:2aa9f933c8d2 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
TMBOY 45:2aa9f933c8d2 13 * See the License for the specific language governing permissions and
TMBOY 45:2aa9f933c8d2 14 * limitations under the License.
TMBOY 45:2aa9f933c8d2 15 */
TMBOY 45:2aa9f933c8d2 16 package com.baidu.duer.dcs.devicemodule.alerts.message;
TMBOY 45:2aa9f933c8d2 17
TMBOY 45:2aa9f933c8d2 18 import org.codehaus.jackson.annotate.JsonCreator;
TMBOY 45:2aa9f933c8d2 19 import org.codehaus.jackson.annotate.JsonProperty;
TMBOY 45:2aa9f933c8d2 20
TMBOY 45:2aa9f933c8d2 21 /**
TMBOY 45:2aa9f933c8d2 22 * Alert 数据对象(model)
TMBOY 45:2aa9f933c8d2 23 * <p>
TMBOY 45:2aa9f933c8d2 24 * Created by guxiuzhong@baidu.com on 2017/5/18.
TMBOY 45:2aa9f933c8d2 25 */
TMBOY 45:2aa9f933c8d2 26 public class Alert {
TMBOY 45:2aa9f933c8d2 27 private final String token;
TMBOY 45:2aa9f933c8d2 28 private final SetAlertPayload.AlertType type;
TMBOY 45:2aa9f933c8d2 29 // 触发时间,ISO 8601格式
TMBOY 45:2aa9f933c8d2 30 private final String scheduledTime;
TMBOY 45:2aa9f933c8d2 31
TMBOY 45:2aa9f933c8d2 32 @JsonCreator
TMBOY 45:2aa9f933c8d2 33 public Alert(@JsonProperty("token") String token, @JsonProperty("type") SetAlertPayload.AlertType type,
TMBOY 45:2aa9f933c8d2 34 @JsonProperty("scheduledTime") String scheduledTime) {
TMBOY 45:2aa9f933c8d2 35 this.token = token;
TMBOY 45:2aa9f933c8d2 36 this.type = type;
TMBOY 45:2aa9f933c8d2 37 this.scheduledTime = scheduledTime;
TMBOY 45:2aa9f933c8d2 38 }
TMBOY 45:2aa9f933c8d2 39
TMBOY 45:2aa9f933c8d2 40 public String getToken() {
TMBOY 45:2aa9f933c8d2 41 return this.token;
TMBOY 45:2aa9f933c8d2 42 }
TMBOY 45:2aa9f933c8d2 43
TMBOY 45:2aa9f933c8d2 44 public SetAlertPayload.AlertType getType() {
TMBOY 45:2aa9f933c8d2 45 return this.type;
TMBOY 45:2aa9f933c8d2 46 }
TMBOY 45:2aa9f933c8d2 47
TMBOY 45:2aa9f933c8d2 48 public String getScheduledTime() {
TMBOY 45:2aa9f933c8d2 49 return scheduledTime;
TMBOY 45:2aa9f933c8d2 50 }
TMBOY 45:2aa9f933c8d2 51
TMBOY 45:2aa9f933c8d2 52 @Override
TMBOY 45:2aa9f933c8d2 53 public int hashCode() {
TMBOY 45:2aa9f933c8d2 54 return ((token == null) ? 0 : token.hashCode());
TMBOY 45:2aa9f933c8d2 55 }
TMBOY 45:2aa9f933c8d2 56
TMBOY 45:2aa9f933c8d2 57 @Override
TMBOY 45:2aa9f933c8d2 58 public boolean equals(Object obj) {
TMBOY 45:2aa9f933c8d2 59 if (this == obj) {
TMBOY 45:2aa9f933c8d2 60 return true;
TMBOY 45:2aa9f933c8d2 61 }
TMBOY 45:2aa9f933c8d2 62 if (obj == null) {
TMBOY 45:2aa9f933c8d2 63 return false;
TMBOY 45:2aa9f933c8d2 64 }
TMBOY 45:2aa9f933c8d2 65 if (getClass() != obj.getClass()) {
TMBOY 45:2aa9f933c8d2 66 return false;
TMBOY 45:2aa9f933c8d2 67 }
TMBOY 45:2aa9f933c8d2 68 Alert other = (Alert) obj;
TMBOY 45:2aa9f933c8d2 69 if (token == null) {
TMBOY 45:2aa9f933c8d2 70 if (other.token != null) {
TMBOY 45:2aa9f933c8d2 71 return false;
TMBOY 45:2aa9f933c8d2 72 }
TMBOY 45:2aa9f933c8d2 73 } else if (!token.equals(other.token)) {
TMBOY 45:2aa9f933c8d2 74 return false;
TMBOY 45:2aa9f933c8d2 75 }
TMBOY 45:2aa9f933c8d2 76 return true;
TMBOY 45:2aa9f933c8d2 77 }
TMBOY 45:2aa9f933c8d2 78 }