fix: APのKeyにidがなくなっていたのを修正

This commit is contained in:
usbharu 2023-05-20 17:56:11 +09:00
parent efd85112ca
commit 2ba2b455da
2 changed files with 18 additions and 6 deletions

View File

@ -8,29 +8,36 @@ open class Key : Object {
constructor( constructor(
type: List<String>, type: List<String>,
name: String, name: String,
id: String?, id: String,
owner: String?, owner: String?,
publicKeyPem: String? publicKeyPem: String?
) : super(add(type, "Key"), name, id) { ) : super(
type = add(list = type, type = "Key"),
name = name,
id = id
) {
this.owner = owner this.owner = owner
this.publicKeyPem = publicKeyPem this.publicKeyPem = publicKeyPem
} }
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true
if (other !is Key) return false if (other !is Key) return false
if (!super.equals(other)) return false if (!super.equals(other)) return false
if (id != other.id) return false
if (owner != other.owner) return false if (owner != other.owner) return false
return publicKeyPem == other.publicKeyPem return publicKeyPem == other.publicKeyPem
} }
override fun hashCode(): Int { override fun hashCode(): Int {
var result = super.hashCode() var result = super.hashCode()
result = 31 * result + (id?.hashCode() ?: 0)
result = 31 * result + (owner?.hashCode() ?: 0) result = 31 * result + (owner?.hashCode() ?: 0)
result = 31 * result + (publicKeyPem?.hashCode() ?: 0) result = 31 * result + (publicKeyPem?.hashCode() ?: 0)
return result return result
} }
override fun toString(): String {
return "Key(owner=$owner, publicKeyPem=$publicKeyPem) ${super.toString()}"
}
} }

View File

@ -20,6 +20,7 @@ open class Object : JsonLd {
this.id = id this.id = id
} }
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true
if (other !is Object) return false if (other !is Object) return false
@ -27,7 +28,8 @@ open class Object : JsonLd {
if (type != other.type) return false if (type != other.type) return false
if (name != other.name) return false if (name != other.name) return false
return actor == other.actor if (actor != other.actor) return false
return id == other.id
} }
override fun hashCode(): Int { override fun hashCode(): Int {
@ -35,10 +37,13 @@ open class Object : JsonLd {
result = 31 * result + type.hashCode() result = 31 * result + type.hashCode()
result = 31 * result + (name?.hashCode() ?: 0) result = 31 * result + (name?.hashCode() ?: 0)
result = 31 * result + (actor?.hashCode() ?: 0) result = 31 * result + (actor?.hashCode() ?: 0)
result = 31 * result + (id?.hashCode() ?: 0)
return result return result
} }
override fun toString(): String = "Object(type=$type, name=$name, actor=$actor) ${super.toString()}" override fun toString(): String {
return "Object(type=$type, name=$name, actor=$actor, id=$id) ${super.toString()}"
}
companion object { companion object {
@JvmStatic @JvmStatic