mirror of https://github.com/usbharu/Hideout.git
reafactor: その他の部分もNull-safeに
This commit is contained in:
parent
2e1cee4e1a
commit
4542fdf68b
|
@ -8,9 +8,7 @@ import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer
|
|||
open class Accept @JsonCreator constructor(
|
||||
type: List<String> = emptyList(),
|
||||
override val name: String,
|
||||
@JsonDeserialize(using = ObjectDeserializer::class)
|
||||
@Suppress("VariableNaming")
|
||||
var `object`: Object?,
|
||||
@JsonDeserialize(using = ObjectDeserializer::class) @Suppress("VariableNaming") var `object`: Object?,
|
||||
override val actor: String
|
||||
) : Object(
|
||||
type = add(type, "Accept")
|
||||
|
|
|
@ -9,11 +9,11 @@ open class Create(
|
|||
override val name: String,
|
||||
@JsonDeserialize(using = ObjectDeserializer::class)
|
||||
@Suppress("VariableNaming")
|
||||
var `object`: Object?,
|
||||
val `object`: Object,
|
||||
override val actor: String,
|
||||
override val id: String,
|
||||
var to: List<String> = emptyList(),
|
||||
var cc: List<String> = emptyList()
|
||||
val to: List<String> = emptyList(),
|
||||
val cc: List<String> = emptyList()
|
||||
) : Object(
|
||||
type = add(type, "Create")
|
||||
),
|
||||
|
|
|
@ -7,8 +7,8 @@ import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer
|
|||
open class Delete : Object, HasId, HasActor {
|
||||
@JsonDeserialize(using = ObjectDeserializer::class)
|
||||
@Suppress("VariableNaming")
|
||||
var `object`: Object? = null
|
||||
var published: String? = null
|
||||
val `object`: Object
|
||||
val published: String
|
||||
override val actor: String
|
||||
override val id: String
|
||||
|
||||
|
@ -17,7 +17,7 @@ open class Delete : Object, HasId, HasActor {
|
|||
actor: String,
|
||||
id: String,
|
||||
`object`: Object,
|
||||
published: String?
|
||||
published: String
|
||||
) : super(add(type, "Delete")) {
|
||||
this.`object` = `object`
|
||||
this.published = published
|
||||
|
|
|
@ -5,16 +5,13 @@ import dev.usbharu.hideout.activitypub.domain.model.objects.Object
|
|||
open class Document(
|
||||
type: List<String> = emptyList(),
|
||||
override val name: String = "",
|
||||
mediaType: String,
|
||||
url: String
|
||||
val mediaType: String,
|
||||
val url: String
|
||||
) : Object(
|
||||
type = add(type, "Document")
|
||||
),
|
||||
HasName {
|
||||
|
||||
var mediaType: String? = mediaType
|
||||
var url: String? = url
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
|
|
@ -6,8 +6,8 @@ open class Emoji(
|
|||
type: List<String>,
|
||||
override val name: String,
|
||||
override val id: String,
|
||||
var updated: String?,
|
||||
var icon: Image?
|
||||
val updated: String,
|
||||
val icon: Image
|
||||
) : Object(
|
||||
type = add(type, "Emoji")
|
||||
),
|
||||
|
|
|
@ -2,22 +2,14 @@ package dev.usbharu.hideout.activitypub.domain.model
|
|||
|
||||
import dev.usbharu.hideout.activitypub.domain.model.objects.Object
|
||||
|
||||
open class Follow : Object, HasActor {
|
||||
@Suppress("VariableNaming")
|
||||
var `object`: String? = null
|
||||
|
||||
open class Follow(
|
||||
type: List<String> = emptyList(),
|
||||
@Suppress("VariableNaming") val `object`: String,
|
||||
override val actor: String
|
||||
|
||||
constructor(
|
||||
type: List<String> = emptyList(),
|
||||
`object`: String?,
|
||||
actor: String
|
||||
) : super(
|
||||
type = add(type, "Follow")
|
||||
) {
|
||||
this.`object` = `object`
|
||||
this.actor = actor
|
||||
}
|
||||
) : Object(
|
||||
type = add(type, "Follow")
|
||||
),
|
||||
HasActor {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
|
|
@ -2,17 +2,13 @@ package dev.usbharu.hideout.activitypub.domain.model
|
|||
|
||||
import dev.usbharu.hideout.activitypub.domain.model.objects.Object
|
||||
|
||||
open class Image : Object {
|
||||
private var mediaType: String? = null
|
||||
private var url: String? = null
|
||||
|
||||
protected constructor() : super()
|
||||
constructor(type: List<String> = emptyList(), mediaType: String?, url: String?) : super(
|
||||
add(type, "Image")
|
||||
) {
|
||||
this.mediaType = mediaType
|
||||
this.url = url
|
||||
}
|
||||
open class Image(
|
||||
type: List<String> = emptyList(),
|
||||
val mediaType: String,
|
||||
val url: String
|
||||
) : Object(
|
||||
add(type, "Image")
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
|
|
@ -2,23 +2,15 @@ package dev.usbharu.hideout.activitypub.domain.model
|
|||
|
||||
import dev.usbharu.hideout.activitypub.domain.model.objects.Object
|
||||
|
||||
open class Key : Object, HasId {
|
||||
var owner: String? = null
|
||||
var publicKeyPem: String? = null
|
||||
override val id: String
|
||||
|
||||
constructor(
|
||||
type: List<String>,
|
||||
id: String,
|
||||
owner: String?,
|
||||
publicKeyPem: String?
|
||||
) : super(
|
||||
type = add(list = type, type = "Key")
|
||||
) {
|
||||
this.owner = owner
|
||||
this.publicKeyPem = publicKeyPem
|
||||
this.id = id
|
||||
}
|
||||
open class Key(
|
||||
type: List<String>,
|
||||
override val id: String,
|
||||
val owner: String,
|
||||
val publicKeyPem: String
|
||||
) : Object(
|
||||
type = add(list = type, type = "Key")
|
||||
),
|
||||
HasId {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
|
|
@ -4,32 +4,18 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize
|
|||
import dev.usbharu.hideout.activitypub.domain.model.objects.Object
|
||||
import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer
|
||||
|
||||
open class Like : Object, HasId, HasActor {
|
||||
@Suppress("VariableNaming")
|
||||
var `object`: String? = null
|
||||
var content: String? = null
|
||||
|
||||
@JsonDeserialize(contentUsing = ObjectDeserializer::class)
|
||||
var tag: List<Object> = emptyList()
|
||||
override val actor: String
|
||||
override val id: String
|
||||
|
||||
constructor(
|
||||
type: List<String> = emptyList(),
|
||||
actor: String,
|
||||
id: String,
|
||||
`object`: String?,
|
||||
content: String?,
|
||||
tag: List<Object> = emptyList()
|
||||
) : super(
|
||||
type = add(type, "Like")
|
||||
) {
|
||||
this.`object` = `object`
|
||||
this.content = content
|
||||
this.tag = tag
|
||||
this.actor = actor
|
||||
this.id = id
|
||||
}
|
||||
open class Like(
|
||||
type: List<String> = emptyList(),
|
||||
override val actor: String,
|
||||
override val id: String,
|
||||
@Suppress("VariableNaming") val `object`: String,
|
||||
val content: String,
|
||||
@JsonDeserialize(contentUsing = ObjectDeserializer::class) val tag: List<Object> = emptyList()
|
||||
) : Object(
|
||||
type = add(type, "Like")
|
||||
),
|
||||
HasId,
|
||||
HasActor {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
|
|
@ -7,14 +7,14 @@ open class Note
|
|||
constructor(
|
||||
type: List<String> = emptyList(),
|
||||
override val id: String,
|
||||
var attributedTo: String,
|
||||
var content: String,
|
||||
var published: String,
|
||||
var to: List<String> = emptyList(),
|
||||
var cc: List<String> = emptyList(),
|
||||
var sensitive: Boolean = false,
|
||||
var inReplyTo: String? = null,
|
||||
var attachment: List<Document> = emptyList()
|
||||
val attributedTo: String,
|
||||
val content: String,
|
||||
val published: String,
|
||||
val to: List<String> = emptyList(),
|
||||
val cc: List<String> = emptyList(),
|
||||
val sensitive: Boolean = false,
|
||||
val inReplyTo: String? = null,
|
||||
val attachment: List<Document> = emptyList()
|
||||
) : Object(
|
||||
type = add(type, "Note")
|
||||
),
|
||||
|
|
|
@ -10,9 +10,9 @@ constructor(
|
|||
override val id: String,
|
||||
var preferredUsername: String?,
|
||||
var summary: String?,
|
||||
var inbox: String?,
|
||||
var outbox: String?,
|
||||
var url: String?,
|
||||
var inbox: String,
|
||||
var outbox: String,
|
||||
var url: String,
|
||||
private var icon: Image?,
|
||||
var publicKey: Key?,
|
||||
var endpoints: Map<String, String> = emptyMap(),
|
||||
|
|
|
@ -4,27 +4,14 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize
|
|||
import dev.usbharu.hideout.activitypub.domain.model.objects.Object
|
||||
import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer
|
||||
|
||||
open class Undo : Object, HasId, HasActor {
|
||||
|
||||
open class Undo(
|
||||
type: List<String> = emptyList(),
|
||||
override val actor: String,
|
||||
override val id: String,
|
||||
@JsonDeserialize(using = ObjectDeserializer::class)
|
||||
@Suppress("VariableNaming")
|
||||
var `object`: Object? = null
|
||||
var published: String? = null
|
||||
override val actor: String
|
||||
override val id: String
|
||||
|
||||
constructor(
|
||||
type: List<String> = emptyList(),
|
||||
actor: String,
|
||||
id: String,
|
||||
`object`: Object,
|
||||
published: String
|
||||
) : super(add(type, "Undo")) {
|
||||
this.`object` = `object`
|
||||
this.published = published
|
||||
this.id = id
|
||||
this.actor = actor
|
||||
}
|
||||
@Suppress("VariableNaming") val `object`: Object,
|
||||
val published: String
|
||||
) : Object(add(type, "Undo")), HasId, HasActor {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
|
|
Loading…
Reference in New Issue