feat: BlockのJSONデシリアライズ用POJOを追加

This commit is contained in:
usbharu 2023-12-07 16:27:55 +09:00
parent c4798d7803
commit 2ffa880c11
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,45 @@
package dev.usbharu.hideout.activitypub.domain.model
import com.fasterxml.jackson.annotation.JsonProperty
import dev.usbharu.hideout.activitypub.domain.model.objects.Object
open class Block(
override val actor: String,
override val id: String,
@JsonProperty("object") val apObject: String
) :
Object(listOf("Block")), HasId, HasActor {
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 Block
if (actor != other.actor) return false
if (id != other.id) return false
if (apObject != other.apObject) return false
return true
}
override fun hashCode(): Int {
var result = super.hashCode()
result = 31 * result + actor.hashCode()
result = 31 * result + id.hashCode()
result = 31 * result + apObject.hashCode()
return result
}
override fun toString(): String {
return "Block(" +
"actor='$actor', " +
"id='$id', " +
"apObject='$apObject'" +
")" +
" ${super.toString()}"
}
}

View File

@ -44,7 +44,7 @@ class ObjectDeserializer : JsonDeserializer<Object>() {
ExtendedActivityVocabulary.Add -> TODO() ExtendedActivityVocabulary.Add -> TODO()
ExtendedActivityVocabulary.Announce -> TODO() ExtendedActivityVocabulary.Announce -> TODO()
ExtendedActivityVocabulary.Arrive -> TODO() ExtendedActivityVocabulary.Arrive -> TODO()
ExtendedActivityVocabulary.Block -> TODO() ExtendedActivityVocabulary.Block -> p.codec.treeToValue(treeNode, Block::class.java)
ExtendedActivityVocabulary.Create -> p.codec.treeToValue(treeNode, Create::class.java) ExtendedActivityVocabulary.Create -> p.codec.treeToValue(treeNode, Create::class.java)
ExtendedActivityVocabulary.Delete -> p.codec.treeToValue(treeNode, Delete::class.java) ExtendedActivityVocabulary.Delete -> p.codec.treeToValue(treeNode, Delete::class.java)
ExtendedActivityVocabulary.Dislike -> TODO() ExtendedActivityVocabulary.Dislike -> TODO()