Added annotation JsonIgnore to control Json serialization on JVM

This commit is contained in:
dankito 2024-08-17 04:39:43 +02:00
parent 3e4dfee615
commit 64a1f3afb5
7 changed files with 22 additions and 1 deletions

View File

@ -84,7 +84,7 @@ kotlin {
jvmMain { jvmMain {
dependencies { dependencies {
implementation("com.fasterxml.jackson.core:jackson-annotations:2.15.0")
} }
} }
jvmTest { } jvmTest { }

View File

@ -0,0 +1,3 @@
package net.codinux.banking.client.model.config
expect annotation class JsonIgnore()

View File

@ -2,6 +2,7 @@ package net.codinux.banking.client.model.response
import net.codinux.banking.client.model.AccountTransaction import net.codinux.banking.client.model.AccountTransaction
import net.codinux.banking.client.model.CustomerAccount import net.codinux.banking.client.model.CustomerAccount
import net.codinux.banking.client.model.config.JsonIgnore
import net.codinux.banking.client.model.config.NoArgConstructor import net.codinux.banking.client.model.config.NoArgConstructor
@NoArgConstructor @NoArgConstructor
@ -9,8 +10,10 @@ class GetAccountDataResponse(
val customer: CustomerAccount val customer: CustomerAccount
) { ) {
@get:JsonIgnore
val bookedTransactions: List<AccountTransaction> val bookedTransactions: List<AccountTransaction>
get() = customer.accounts.flatMap { it.bookedTransactions }.sortedByDescending { it.valueDate } get() = customer.accounts.flatMap { it.bookedTransactions }.sortedByDescending { it.valueDate }
override fun toString() = customer.toString() override fun toString() = customer.toString()
} }

View File

@ -0,0 +1,3 @@
package net.codinux.banking.client.model.config
actual annotation class JsonIgnore

View File

@ -0,0 +1,6 @@
package net.codinux.banking.client.model.config
import com.fasterxml.jackson.annotation.JsonIgnore
@JsonIgnore
actual annotation class JsonIgnore

View File

@ -0,0 +1,3 @@
package net.codinux.banking.client.model.config
actual annotation class JsonIgnore

View File

@ -0,0 +1,3 @@
package net.codinux.banking.client.model.config
actual annotation class JsonIgnore