forked from pengrad/java-telegram-bot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGiftInfo.kt
More file actions
48 lines (41 loc) · 1.98 KB
/
GiftInfo.kt
File metadata and controls
48 lines (41 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.pengrad.telegrambot.model.gift
import com.pengrad.telegrambot.model.MessageEntity
data class GiftInfo(
@get:JvmName("gift") val gift: Gift,
@get:JvmName("ownedGiftId") val ownedGiftId: String?,
@get:JvmName("convertStarCount") val convertStarCount: Int?,
@get:JvmName("prepaidUpgradeStarCount") val prepaidUpgradeStarCount: Int?,
@get:JvmName("canBeUpgraded") val canBeUpgraded: Boolean?,
@get:JvmName("text") val text: String?,
@get:JvmName("entities") val entities: Array<MessageEntity>?,
@get:JvmName("isPrivate") val isPrivate: Boolean?,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is GiftInfo) return false
return gift == other.gift &&
ownedGiftId == other.ownedGiftId &&
convertStarCount == other.convertStarCount &&
prepaidUpgradeStarCount == other.prepaidUpgradeStarCount &&
canBeUpgraded == other.canBeUpgraded &&
text == other.text &&
entities contentEquals other.entities &&
isPrivate == other.isPrivate
}
override fun hashCode(): Int {
var result = gift.hashCode()
result = 31 * result + (ownedGiftId?.hashCode() ?: 0)
result = 31 * result + (convertStarCount ?: 0)
result = 31 * result + (prepaidUpgradeStarCount ?: 0)
result = 31 * result + (canBeUpgraded?.hashCode() ?: 0)
result = 31 * result + (text?.hashCode() ?: 0)
result = 31 * result + (entities?.contentHashCode() ?: 0)
result = 31 * result + (isPrivate?.hashCode() ?: 0)
return result
}
override fun toString(): String {
return "GiftInfo(gift=$gift, ownedGiftId=$ownedGiftId, convertStarCount=$convertStarCount, " +
"prepaidUpgradeStarCount=$prepaidUpgradeStarCount, canBeUpgraded=$canBeUpgraded, " +
"text=$text, entities=${entities?.contentToString()}, isPrivate=$isPrivate)"
}
}