Migrate Nc to kotlin data classes

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-05-17 22:45:06 +02:00
parent 32a83f066f
commit cf568a00eb
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
8 changed files with 177 additions and 540 deletions

View File

@ -1,107 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@JsonObject
@Parcel
public class NCIceCandidate {
@JsonField(name = "sdpMLineIndex")
int sdpMLineIndex;
@JsonField(name = "sdpMid")
String sdpMid;
@JsonField(name = "candidate")
String candidate;
public int getSdpMLineIndex() {
return this.sdpMLineIndex;
}
public String getSdpMid() {
return this.sdpMid;
}
public String getCandidate() {
return this.candidate;
}
public void setSdpMLineIndex(int sdpMLineIndex) {
this.sdpMLineIndex = sdpMLineIndex;
}
public void setSdpMid(String sdpMid) {
this.sdpMid = sdpMid;
}
public void setCandidate(String candidate) {
this.candidate = candidate;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof NCIceCandidate)) {
return false;
}
final NCIceCandidate other = (NCIceCandidate) o;
if (!other.canEqual((Object) this)) {
return false;
}
if (this.getSdpMLineIndex() != other.getSdpMLineIndex()) {
return false;
}
final Object this$sdpMid = this.getSdpMid();
final Object other$sdpMid = other.getSdpMid();
if (this$sdpMid == null ? other$sdpMid != null : !this$sdpMid.equals(other$sdpMid)) {
return false;
}
final Object this$candidate = this.getCandidate();
final Object other$candidate = other.getCandidate();
return this$candidate == null ? other$candidate == null : this$candidate.equals(other$candidate);
}
protected boolean canEqual(final Object other) {
return other instanceof NCIceCandidate;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.getSdpMLineIndex();
final Object $sdpMid = this.getSdpMid();
result = result * PRIME + ($sdpMid == null ? 43 : $sdpMid.hashCode());
final Object $candidate = this.getCandidate();
result = result * PRIME + ($candidate == null ? 43 : $candidate.hashCode());
return result;
}
public String toString() {
return "NCIceCandidate(sdpMLineIndex=" + this.getSdpMLineIndex() + ", sdpMid=" + this.getSdpMid() + ", candidate=" + this.getCandidate() + ")";
}
}

View File

@ -0,0 +1,41 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.signaling
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class NCIceCandidate(
@JsonField(name = ["sdpMLineIndex"])
var sdpMLineIndex: Int = 0,
@JsonField(name = ["sdpMid"])
var sdpMid: String? = null,
@JsonField(name = ["candidate"])
var candidate: String? = null
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(0, null, null)
}

View File

@ -1,146 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@JsonObject
@Parcel
public class NCMessagePayload {
@JsonField(name = "type")
String type;
@JsonField(name = "sdp")
String sdp;
@JsonField(name = "nick")
String nick;
@JsonField(name = "candidate")
NCIceCandidate iceCandidate;
@JsonField(name = "name")
String name;
public String getType() {
return this.type;
}
public String getSdp() {
return this.sdp;
}
public String getNick() {
return this.nick;
}
public NCIceCandidate getIceCandidate() {
return this.iceCandidate;
}
public String getName() {
return this.name;
}
public void setType(String type) {
this.type = type;
}
public void setSdp(String sdp) {
this.sdp = sdp;
}
public void setNick(String nick) {
this.nick = nick;
}
public void setIceCandidate(NCIceCandidate iceCandidate) {
this.iceCandidate = iceCandidate;
}
public void setName(String name) {
this.name = name;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof NCMessagePayload)) {
return false;
}
final NCMessagePayload other = (NCMessagePayload) 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$sdp = this.getSdp();
final Object other$sdp = other.getSdp();
if (this$sdp == null ? other$sdp != null : !this$sdp.equals(other$sdp)) {
return false;
}
final Object this$nick = this.getNick();
final Object other$nick = other.getNick();
if (this$nick == null ? other$nick != null : !this$nick.equals(other$nick)) {
return false;
}
final Object this$iceCandidate = this.getIceCandidate();
final Object other$iceCandidate = other.getIceCandidate();
if (this$iceCandidate == null ? other$iceCandidate != null : !this$iceCandidate.equals(other$iceCandidate)) {
return false;
}
final Object this$name = this.getName();
final Object other$name = other.getName();
return this$name == null ? other$name == null : this$name.equals(other$name);
}
protected boolean canEqual(final Object other) {
return other instanceof NCMessagePayload;
}
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 $sdp = this.getSdp();
result = result * PRIME + ($sdp == null ? 43 : $sdp.hashCode());
final Object $nick = this.getNick();
result = result * PRIME + ($nick == null ? 43 : $nick.hashCode());
final Object $iceCandidate = this.getIceCandidate();
result = result * PRIME + ($iceCandidate == null ? 43 : $iceCandidate.hashCode());
final Object $name = this.getName();
result = result * PRIME + ($name == null ? 43 : $name.hashCode());
return result;
}
public String toString() {
return "NCMessagePayload(type=" + this.getType() + ", sdp=" + this.getSdp() + ", nick=" + this.getNick() + ", iceCandidate=" + this.getIceCandidate() + ", name=" + this.getName() + ")";
}
}

View File

@ -0,0 +1,45 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.signaling
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class NCMessagePayload(
@JsonField(name = ["type"])
var type: String? = null,
@JsonField(name = ["sdp"])
var sdp: String? = null,
@JsonField(name = ["nick"])
var nick: String? = null,
@JsonField(name = ["candidate"])
var iceCandidate: NCIceCandidate? = null,
@JsonField(name = ["name"])
var name: String? = null
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null, null, null, null)
}

View File

@ -1,111 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@JsonObject
@Parcel
public class NCMessageWrapper {
@JsonField(name = "fn")
NCSignalingMessage signalingMessage;
// always a "message"
@JsonField(name = "ev")
String ev;
@JsonField(name = "sessionId")
String sessionId;
public NCSignalingMessage getSignalingMessage() {
return this.signalingMessage;
}
public String getEv() {
return this.ev;
}
public String getSessionId() {
return this.sessionId;
}
public void setSignalingMessage(NCSignalingMessage signalingMessage) {
this.signalingMessage = signalingMessage;
}
public void setEv(String ev) {
this.ev = ev;
}
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof NCMessageWrapper)) {
return false;
}
final NCMessageWrapper other = (NCMessageWrapper) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$signalingMessage = this.getSignalingMessage();
final Object other$signalingMessage = other.getSignalingMessage();
if (this$signalingMessage == null ? other$signalingMessage != null : !this$signalingMessage.equals(other$signalingMessage)) {
return false;
}
final Object this$ev = this.getEv();
final Object other$ev = other.getEv();
if (this$ev == null ? other$ev != null : !this$ev.equals(other$ev)) {
return false;
}
final Object this$sessionId = this.getSessionId();
final Object other$sessionId = other.getSessionId();
return this$sessionId == null ? other$sessionId == null : this$sessionId.equals(other$sessionId);
}
protected boolean canEqual(final Object other) {
return other instanceof NCMessageWrapper;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $signalingMessage = this.getSignalingMessage();
result = result * PRIME + ($signalingMessage == null ? 43 : $signalingMessage.hashCode());
final Object $ev = this.getEv();
result = result * PRIME + ($ev == null ? 43 : $ev.hashCode());
final Object $sessionId = this.getSessionId();
result = result * PRIME + ($sessionId == null ? 43 : $sessionId.hashCode());
return result;
}
public String toString() {
return "NCMessageWrapper(signalingMessage=" + this.getSignalingMessage() + ", ev=" + this.getEv() + ", sessionId=" + this.getSessionId() + ")";
}
}

View File

@ -0,0 +1,42 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.signaling
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class NCMessageWrapper(
@JsonField(name = ["fn"])
var signalingMessage: NCSignalingMessage? = null,
/** always a "message" */
@JsonField(name = ["ev"])
var ev: String? = null,
@JsonField(name = ["sessionId"])
var sessionId: String? = null
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null, null)
}

View File

@ -1,176 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.signaling;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@JsonObject
@Parcel
public class NCSignalingMessage {
@JsonField(name = "from")
String from;
@JsonField(name = "to")
String to;
@JsonField(name = "type")
String type;
@JsonField(name = "payload")
NCMessagePayload payload;
@JsonField(name = "roomType")
String roomType;
@JsonField(name = "sid")
String sid;
@JsonField(name = "prefix")
String prefix;
public String getFrom() {
return this.from;
}
public String getTo() {
return this.to;
}
public String getType() {
return this.type;
}
public NCMessagePayload getPayload() {
return this.payload;
}
public String getRoomType() {
return this.roomType;
}
public String getSid() {
return this.sid;
}
public String getPrefix() {
return this.prefix;
}
public void setFrom(String from) {
this.from = from;
}
public void setTo(String to) {
this.to = to;
}
public void setType(String type) {
this.type = type;
}
public void setPayload(NCMessagePayload payload) {
this.payload = payload;
}
public void setRoomType(String roomType) {
this.roomType = roomType;
}
public void setSid(String sid) {
this.sid = sid;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof NCSignalingMessage)) {
return false;
}
final NCSignalingMessage other = (NCSignalingMessage) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$from = this.getFrom();
final Object other$from = other.getFrom();
if (this$from == null ? other$from != null : !this$from.equals(other$from)) {
return false;
}
final Object this$to = this.getTo();
final Object other$to = other.getTo();
if (this$to == null ? other$to != null : !this$to.equals(other$to)) {
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$payload = this.getPayload();
final Object other$payload = other.getPayload();
if (this$payload == null ? other$payload != null : !this$payload.equals(other$payload)) {
return false;
}
final Object this$roomType = this.getRoomType();
final Object other$roomType = other.getRoomType();
if (this$roomType == null ? other$roomType != null : !this$roomType.equals(other$roomType)) {
return false;
}
final Object this$sid = this.getSid();
final Object other$sid = other.getSid();
if (this$sid == null ? other$sid != null : !this$sid.equals(other$sid)) {
return false;
}
final Object this$prefix = this.getPrefix();
final Object other$prefix = other.getPrefix();
return this$prefix == null ? other$prefix == null : this$prefix.equals(other$prefix);
}
protected boolean canEqual(final Object other) {
return other instanceof NCSignalingMessage;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $from = this.getFrom();
result = result * PRIME + ($from == null ? 43 : $from.hashCode());
final Object $to = this.getTo();
result = result * PRIME + ($to == null ? 43 : $to.hashCode());
final Object $type = this.getType();
result = result * PRIME + ($type == null ? 43 : $type.hashCode());
final Object $payload = this.getPayload();
result = result * PRIME + ($payload == null ? 43 : $payload.hashCode());
final Object $roomType = this.getRoomType();
result = result * PRIME + ($roomType == null ? 43 : $roomType.hashCode());
final Object $sid = this.getSid();
result = result * PRIME + ($sid == null ? 43 : $sid.hashCode());
final Object $prefix = this.getPrefix();
result = result * PRIME + ($prefix == null ? 43 : $prefix.hashCode());
return result;
}
public String toString() {
return "NCSignalingMessage(from=" + this.getFrom() + ", to=" + this.getTo() + ", type=" + this.getType() + ", payload=" + this.getPayload() + ", roomType=" + this.getRoomType() + ", sid=" + this.getSid() + ", prefix=" + this.getPrefix() + ")";
}
}

View File

@ -0,0 +1,49 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.signaling
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class NCSignalingMessage(
@JsonField(name = ["from"])
var from: String? = null,
@JsonField(name = ["to"])
var to: String? = null,
@JsonField(name = ["type"])
var type: String? = null,
@JsonField(name = ["payload"])
var payload: NCMessagePayload? = null,
@JsonField(name = ["roomType"])
var roomType: String? = null,
@JsonField(name = ["sid"])
var sid: String? = null,
@JsonField(name = ["prefix"])
var prefix: String? = null
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null, null, null, null, null, null)
}