Commit ba212d2b authored by Him188's avatar Him188

Generate `equals` and `hashCode` for BotAccount

parent 45d5131e
......@@ -26,6 +26,24 @@ data class BotAccount(
val passwordMd5: ByteArray // md5
) {
constructor(id: Long, passwordPlainText: String) : this(id, md5(passwordPlainText.toByteArray()))
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as BotAccount
if (id != other.id) return false
if (!passwordMd5.contentEquals(other.passwordMd5)) return false
return true
}
override fun hashCode(): Int {
var result = id.hashCode()
result = 31 * result + passwordMd5.contentHashCode()
return result
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment