From 2f84685cccc5c026fc190aa1f03cd34eee6e5992 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Wed, 18 May 2022 00:28:36 +0200 Subject: [PATCH] Migrate EventOverallWebSocketMessage to kotlin data class Signed-off-by: Andy Scherzinger --- .../EventOverallWebSocketMessage.java | 95 ------------------- .../websocket/EventOverallWebSocketMessage.kt | 43 +++++++++ 2 files changed, 43 insertions(+), 95 deletions(-) delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.kt diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.java deleted file mode 100644 index 83520bb0f..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * @author Andy Scherzinger - * Copyright (C) 2022 Andy Scherzinger - * Copyright (C) 2017-2018 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.nextcloud.talk.models.json.websocket; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -import java.util.HashMap; - -@Parcel -@JsonObject -public class EventOverallWebSocketMessage { - @JsonField(name = "type") - String type; - @JsonField(name = "event") - HashMap eventMap; - - public String getType() { - return this.type; - } - - public HashMap getEventMap() { - return this.eventMap; - } - - public void setType(String type) { - this.type = type; - } - - public void setEventMap(HashMap eventMap) { - this.eventMap = eventMap; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof EventOverallWebSocketMessage)) { - return false; - } - final EventOverallWebSocketMessage other = (EventOverallWebSocketMessage) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$type = this.getType(); - final Object other$type = other.getType(); - if (this$type == null ? other$type != null : !this$type.equals(other$type)) { - return false; - } - final Object this$eventMap = this.getEventMap(); - final Object other$eventMap = other.getEventMap(); - - return this$eventMap == null ? other$eventMap == null : this$eventMap.equals(other$eventMap); - } - - protected boolean canEqual(final Object other) { - return other instanceof EventOverallWebSocketMessage; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $type = this.getType(); - result = result * PRIME + ($type == null ? 43 : $type.hashCode()); - final Object $eventMap = this.getEventMap(); - result = result * PRIME + ($eventMap == null ? 43 : $eventMap.hashCode()); - return result; - } - - public String toString() { - return "EventOverallWebSocketMessage(type=" + this.getType() + ", eventMap=" + this.getEventMap() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.kt new file mode 100644 index 000000000..dc06c0329 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/websocket/EventOverallWebSocketMessage.kt @@ -0,0 +1,43 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017-2018 Mario Danic + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.nextcloud.talk.models.json.websocket + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.AnyParceler +import kotlinx.android.parcel.Parcelize +import kotlinx.android.parcel.TypeParceler +import java.util.HashMap + +@Parcelize +@JsonObject +@TypeParceler +class EventOverallWebSocketMessage( + @JsonField(name = ["type"]) + var type: String? = null, + @JsonField(name = ["event"]) + var eventMap: HashMap? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null) +}