fix: Objectのデイシリアライズに失敗したときnullを返すように

This commit is contained in:
usbharu 2023-12-22 16:23:18 +09:00
parent 87cd172165
commit bed0b84d16
1 changed files with 42 additions and 42 deletions

View File

@ -26,69 +26,69 @@ class ObjectDeserializer : JsonDeserializer<Object>() {
} else if (type.isValueNode) { } else if (type.isValueNode) {
ExtendedActivityVocabulary.values().firstOrNull() { it.name.equals(type.asText(), true) } ExtendedActivityVocabulary.values().firstOrNull() { it.name.equals(type.asText(), true) }
} else { } else {
TODO() null
} }
return when (activityType) { return when (activityType) {
ExtendedActivityVocabulary.Follow -> p.codec.treeToValue(treeNode, Follow::class.java) ExtendedActivityVocabulary.Follow -> p.codec.treeToValue(treeNode, Follow::class.java)
ExtendedActivityVocabulary.Note -> p.codec.treeToValue(treeNode, Note::class.java) ExtendedActivityVocabulary.Note -> p.codec.treeToValue(treeNode, Note::class.java)
ExtendedActivityVocabulary.Object -> p.codec.treeToValue(treeNode, Object::class.java) ExtendedActivityVocabulary.Object -> p.codec.treeToValue(treeNode, Object::class.java)
ExtendedActivityVocabulary.Link -> TODO() ExtendedActivityVocabulary.Link -> null
ExtendedActivityVocabulary.Activity -> TODO() ExtendedActivityVocabulary.Activity -> null
ExtendedActivityVocabulary.IntransitiveActivity -> TODO() ExtendedActivityVocabulary.IntransitiveActivity -> null
ExtendedActivityVocabulary.Collection -> TODO() ExtendedActivityVocabulary.Collection -> null
ExtendedActivityVocabulary.OrderedCollection -> TODO() ExtendedActivityVocabulary.OrderedCollection -> null
ExtendedActivityVocabulary.CollectionPage -> TODO() ExtendedActivityVocabulary.CollectionPage -> null
ExtendedActivityVocabulary.OrderedCollectionPage -> TODO() ExtendedActivityVocabulary.OrderedCollectionPage -> null
ExtendedActivityVocabulary.Accept -> p.codec.treeToValue(treeNode, Accept::class.java) ExtendedActivityVocabulary.Accept -> p.codec.treeToValue(treeNode, Accept::class.java)
ExtendedActivityVocabulary.Add -> TODO() ExtendedActivityVocabulary.Add -> null
ExtendedActivityVocabulary.Announce -> TODO() ExtendedActivityVocabulary.Announce -> null
ExtendedActivityVocabulary.Arrive -> TODO() ExtendedActivityVocabulary.Arrive -> null
ExtendedActivityVocabulary.Block -> p.codec.treeToValue(treeNode, Block::class.java) 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 -> null
ExtendedActivityVocabulary.Flag -> TODO() ExtendedActivityVocabulary.Flag -> null
ExtendedActivityVocabulary.Ignore -> TODO() ExtendedActivityVocabulary.Ignore -> null
ExtendedActivityVocabulary.Invite -> TODO() ExtendedActivityVocabulary.Invite -> null
ExtendedActivityVocabulary.Join -> TODO() ExtendedActivityVocabulary.Join -> null
ExtendedActivityVocabulary.Leave -> TODO() ExtendedActivityVocabulary.Leave -> null
ExtendedActivityVocabulary.Like -> p.codec.treeToValue(treeNode, Like::class.java) ExtendedActivityVocabulary.Like -> p.codec.treeToValue(treeNode, Like::class.java)
ExtendedActivityVocabulary.Listen -> TODO() ExtendedActivityVocabulary.Listen -> null
ExtendedActivityVocabulary.Move -> TODO() ExtendedActivityVocabulary.Move -> null
ExtendedActivityVocabulary.Offer -> TODO() ExtendedActivityVocabulary.Offer -> null
ExtendedActivityVocabulary.Question -> TODO() ExtendedActivityVocabulary.Question -> null
ExtendedActivityVocabulary.Reject -> p.codec.treeToValue(treeNode, Reject::class.java) ExtendedActivityVocabulary.Reject -> p.codec.treeToValue(treeNode, Reject::class.java)
ExtendedActivityVocabulary.Read -> TODO() ExtendedActivityVocabulary.Read -> null
ExtendedActivityVocabulary.Remove -> TODO() ExtendedActivityVocabulary.Remove -> null
ExtendedActivityVocabulary.TentativeReject -> TODO() ExtendedActivityVocabulary.TentativeReject -> null
ExtendedActivityVocabulary.TentativeAccept -> TODO() ExtendedActivityVocabulary.TentativeAccept -> null
ExtendedActivityVocabulary.Travel -> TODO() ExtendedActivityVocabulary.Travel -> null
ExtendedActivityVocabulary.Undo -> p.codec.treeToValue(treeNode, Undo::class.java) ExtendedActivityVocabulary.Undo -> p.codec.treeToValue(treeNode, Undo::class.java)
ExtendedActivityVocabulary.Update -> TODO() ExtendedActivityVocabulary.Update -> null
ExtendedActivityVocabulary.View -> TODO() ExtendedActivityVocabulary.View -> null
ExtendedActivityVocabulary.Application -> TODO() ExtendedActivityVocabulary.Application -> null
ExtendedActivityVocabulary.Group -> TODO() ExtendedActivityVocabulary.Group -> null
ExtendedActivityVocabulary.Organization -> TODO() ExtendedActivityVocabulary.Organization -> null
ExtendedActivityVocabulary.Person -> p.codec.treeToValue(treeNode, Person::class.java) ExtendedActivityVocabulary.Person -> p.codec.treeToValue(treeNode, Person::class.java)
ExtendedActivityVocabulary.Service -> TODO() ExtendedActivityVocabulary.Service -> null
ExtendedActivityVocabulary.Article -> TODO() ExtendedActivityVocabulary.Article -> null
ExtendedActivityVocabulary.Audio -> TODO() ExtendedActivityVocabulary.Audio -> null
ExtendedActivityVocabulary.Document -> p.codec.treeToValue(treeNode, Document::class.java) ExtendedActivityVocabulary.Document -> p.codec.treeToValue(treeNode, Document::class.java)
ExtendedActivityVocabulary.Event -> TODO() ExtendedActivityVocabulary.Event -> null
ExtendedActivityVocabulary.Image -> p.codec.treeToValue(treeNode, Image::class.java) ExtendedActivityVocabulary.Image -> p.codec.treeToValue(treeNode, Image::class.java)
ExtendedActivityVocabulary.Page -> TODO() ExtendedActivityVocabulary.Page -> null
ExtendedActivityVocabulary.Place -> TODO() ExtendedActivityVocabulary.Place -> null
ExtendedActivityVocabulary.Profile -> TODO() ExtendedActivityVocabulary.Profile -> null
ExtendedActivityVocabulary.Relationship -> TODO() ExtendedActivityVocabulary.Relationship -> null
ExtendedActivityVocabulary.Tombstone -> p.codec.treeToValue(treeNode, Tombstone::class.java) ExtendedActivityVocabulary.Tombstone -> p.codec.treeToValue(treeNode, Tombstone::class.java)
ExtendedActivityVocabulary.Video -> TODO() ExtendedActivityVocabulary.Video -> null
ExtendedActivityVocabulary.Mention -> TODO() ExtendedActivityVocabulary.Mention -> null
ExtendedActivityVocabulary.Emoji -> p.codec.treeToValue(treeNode, Emoji::class.java) ExtendedActivityVocabulary.Emoji -> p.codec.treeToValue(treeNode, Emoji::class.java)
null -> null null -> null
} }
} else { } else {
TODO() return null
} }
} }
} }