mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-22 13:46:13 +08:00
Generate equals
, hashCode
and toString
for AnnouncementParameters
abd AnnouncementImage
This commit is contained in:
parent
cf7b2a14a1
commit
9f1343c02e
@ -30,4 +30,28 @@ public class AnnouncementImage @MiraiInternalApi public constructor(
|
||||
public companion object {
|
||||
public const val SERIAL_NAME: String = "AnnouncementImage"
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "AnnouncementImage(height='$height', width='$width', id='$id')"
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as AnnouncementImage
|
||||
|
||||
if (height != other.height) return false
|
||||
if (width != other.width) return false
|
||||
if (id != other.id) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = height.hashCode()
|
||||
result = 31 * result + width.hashCode()
|
||||
result = 31 * result + id.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
@ -76,4 +76,34 @@ public class AnnouncementParameters internal constructor(
|
||||
@get:JvmName("getDefault")
|
||||
public val DEFAULT: AnnouncementParameters = AnnouncementParameters()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as AnnouncementParameters
|
||||
|
||||
if (image != other.image) return false
|
||||
if (sendToNewMember != other.sendToNewMember) return false
|
||||
if (isPinned != other.isPinned) return false
|
||||
if (isShowEditCard != other.isShowEditCard) return false
|
||||
if (isTip != other.isTip) return false
|
||||
if (needConfirm != other.needConfirm) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = image?.hashCode() ?: 0
|
||||
result = 31 * result + sendToNewMember.hashCode()
|
||||
result = 31 * result + isPinned.hashCode()
|
||||
result = 31 * result + isShowEditCard.hashCode()
|
||||
result = 31 * result + isTip.hashCode()
|
||||
result = 31 * result + needConfirm.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "AnnouncementParameters(image=$image, sendToNewMember=$sendToNewMember, isPinned=$isPinned, isShowEditCard=$isShowEditCard, isTip=$isTip, needConfirm=$needConfirm)"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user