From ec848630ca5382d8f2146a12168b5dde61c7f369 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:37:59 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20toString=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activitypub/domain/model/Delete.kt | 13 +++++- .../hideout/activitypub/domain/model/Emoji.kt | 12 +++++- .../activitypub/domain/model/Follow.kt | 10 ++++- .../hideout/activitypub/domain/model/Undo.kt | 13 +++++- .../hideout/core/domain/model/actor/Actor.kt | 42 +++++++++++-------- .../httpsignature/HttpSignatureUser.kt | 10 +++++ .../springframework/oauth2/UserDetailsImpl.kt | 9 ++++ .../interfaces/api/status/StatusesRequest.kt | 15 +++++-- .../dev/usbharu/hideout/util/LruCache.kt | 7 ++++ 9 files changed, 104 insertions(+), 27 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Delete.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Delete.kt index 6f691492..f812b32a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Delete.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Delete.kt @@ -50,6 +50,15 @@ open class Delete : Object, HasId, HasActor { return result } - override fun toString(): String = - "Delete(`object`=$apObject, published=$published, actor='$actor', id='$id') ${super.toString()}" + override fun toString(): String { + return "Delete(" + + "apObject=$apObject, " + + "published='$published', " + + "actor='$actor', " + + "id='$id'" + + ")" + + " ${super.toString()}" + } + + } diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Emoji.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Emoji.kt index 37ebb879..a856e9a3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Emoji.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Emoji.kt @@ -30,5 +30,15 @@ open class Emoji( return result } - override fun toString(): String = "Emoji(updated=$updated, icon=$icon) ${super.toString()}" + override fun toString(): String { + return "Emoji(" + + "name='$name', " + + "id='$id', " + + "updated='$updated', " + + "icon=$icon" + + ")" + + " ${super.toString()}" + } + + } diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Follow.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Follow.kt index c7f292ba..536d38b2 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Follow.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Follow.kt @@ -32,5 +32,13 @@ open class Follow( return result } - override fun toString(): String = "Follow(`object`=$apObject, actor='$actor') ${super.toString()}" + override fun toString(): String { + return "Follow(" + + "apObject='$apObject', " + + "actor='$actor'" + + ")" + + " ${super.toString()}" + } + + } diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt index b1399777..6ec8e44e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/domain/model/Undo.kt @@ -38,6 +38,15 @@ open class Undo( return result } - override fun toString(): String = - "Undo(`object`=$apObject, published=$published, actor='$actor', id='$id') ${super.toString()}" + override fun toString(): String { + return "Undo(" + + "actor='$actor', " + + "id='$id', " + + "apObject=$apObject, " + + "published='$published'" + + ")" + + " ${super.toString()}" + } + + } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/actor/Actor.kt b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/actor/Actor.kt index 3833e71a..31dc4c6a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/domain/model/actor/Actor.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/domain/model/actor/Actor.kt @@ -181,25 +181,31 @@ data class Actor private constructor( fun decrementPostsCount(): Actor = this.copy(postsCount = this.postsCount - 1) fun withLastPostAt(lastPostDate: Instant): Actor = this.copy(lastPostDate = lastPostDate) - + override fun toString(): String { return "Actor(" + - "id=$id, " + - "name='$name', " + - "domain='$domain', " + - "screenName='$screenName', " + - "description='$description', " + - "inbox='$inbox', " + - "outbox='$outbox', " + - "url='$url', " + - "publicKey='$publicKey', " + - "privateKey=$privateKey, " + - "createdAt=$createdAt, " + - "keyId='$keyId', " + - "followers=$followers, " + - "following=$following, " + - "instance=$instance, " + - "locked=$locked" + - ")" + "id=$id, " + + "name='$name', " + + "domain='$domain', " + + "screenName='$screenName', " + + "description='$description', " + + "inbox='$inbox', " + + "outbox='$outbox', " + + "url='$url', " + + "publicKey='$publicKey', " + + "privateKey=$privateKey, " + + "createdAt=$createdAt, " + + "keyId='$keyId', " + + "followers=$followers, " + + "following=$following, " + + "instance=$instance, " + + "locked=$locked, " + + "followersCount=$followersCount, " + + "followingCount=$followingCount, " + + "postsCount=$postsCount, " + + "lastPostDate=$lastPostDate" + + ")" } + + } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUser.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUser.kt index 8beb4513..1b2a33a8 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUser.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/httpsignature/HttpSignatureUser.kt @@ -39,8 +39,18 @@ class HttpSignatureUser( return result } + override fun toString(): String { + return "HttpSignatureUser(" + + "domain='$domain', " + + "id=$id" + + ")" + + " ${super.toString()}" + } + companion object { @Serial private const val serialVersionUID: Long = -3330552099960982997L } + + } diff --git a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsImpl.kt b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsImpl.kt index 92b007da..dbd4e542 100644 --- a/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/core/infrastructure/springframework/oauth2/UserDetailsImpl.kt @@ -30,6 +30,15 @@ class UserDetailsImpl( @Serial private const val serialVersionUID: Long = -899168205656607781L } + + override fun toString(): String { + return "UserDetailsImpl(" + + "id=$id" + + ")" + + " ${super.toString()}" + } + + } @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY) diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt index 98803f6b..a8cb0ec9 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/StatusesRequest.kt @@ -65,11 +65,20 @@ class StatusesRequest { } override fun toString(): String { - return "StatusesRequest(status=$status, mediaIds=$media_ids, poll=$poll, inReplyToId=$in_reply_to_id, " + - "sensitive=$sensitive, spoilerText=$spoiler_text, visibility=$visibility, language=$language," + - " scheduledAt=$scheduled_at)" + return "StatusesRequest(" + + "status=$status, " + + "media_ids=$media_ids, " + + "poll=$poll, " + + "in_reply_to_id=$in_reply_to_id, " + + "sensitive=$sensitive, " + + "spoiler_text=$spoiler_text, " + + "visibility=$visibility, " + + "language=$language, " + + "scheduled_at=$scheduled_at" + + ")" } + @Suppress("EnumNaming", "EnumEntryNameCase") enum class Visibility { `public`, diff --git a/src/main/kotlin/dev/usbharu/hideout/util/LruCache.kt b/src/main/kotlin/dev/usbharu/hideout/util/LruCache.kt index 3f65175a..e62469a0 100644 --- a/src/main/kotlin/dev/usbharu/hideout/util/LruCache.kt +++ b/src/main/kotlin/dev/usbharu/hideout/util/LruCache.kt @@ -5,6 +5,13 @@ import java.io.Serial class LruCache(private val maxSize: Int) : LinkedHashMap(15, 0.75f, true) { override fun removeEldestEntry(eldest: MutableMap.MutableEntry?): Boolean = size > maxSize + override fun toString(): String { + return "LruCache(" + + "maxSize=$maxSize" + + ")" + + " ${super.toString()}" + } + companion object { @Serial