feat: equalsとtoStringを実装

This commit is contained in:
usbharu 2024-02-03 16:20:07 +09:00
parent 7b9ef770da
commit 8b1d1a5b09
1 changed files with 41 additions and 1 deletions

View File

@ -17,4 +17,44 @@ open class Announce @JsonCreator constructor(
type = add(type, "Announce")
),
HasActor,
HasId
HasId{
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
if (!super.equals(other)) return false
other as Announce
if (apObject != other.apObject) return false
if (actor != other.actor) return false
if (id != other.id) return false
if (published != other.published) return false
if (to != other.to) return false
if (cc != other.cc) return false
return true
}
override fun hashCode(): Int {
var result = super.hashCode()
result = 31 * result + apObject.hashCode()
result = 31 * result + actor.hashCode()
result = 31 * result + id.hashCode()
result = 31 * result + published.hashCode()
result = 31 * result + to.hashCode()
result = 31 * result + cc.hashCode()
return result
}
override fun toString(): String {
return "Announce(" +
"apObject='$apObject', " +
"actor='$actor', " +
"id='$id', " +
"published='$published', " +
"to=$to, " +
"cc=$cc" +
")" +
" ${super.toString()}"
}
}