Added no-arg constructors so that e.g. deserialization with Jackson works

This commit is contained in:
dankito 2024-08-17 01:50:48 +02:00
parent 21d13622d3
commit 2a90e6d19d
8 changed files with 30 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
plugins {
kotlin("multiplatform")
kotlin("plugin.noarg")
}
@ -101,6 +102,11 @@ kotlin {
}
noArg {
annotation("net.codinux.accounting.common.config.NoArgConstructor")
}
ext["customArtifactId"] = "banking-client-model"

View File

@ -1,7 +1,12 @@
package net.codinux.banking.client.model
import net.codinux.banking.client.model.config.NoArgConstructor
@NoArgConstructor
class AccountCredentials(
var bankCode: String,
var loginName: String,
var password: String
)
) {
override fun toString() = "$bankCode $loginName"
}

View File

@ -1,7 +1,9 @@
package net.codinux.banking.client.model
import kotlinx.datetime.LocalDate
import net.codinux.banking.client.model.config.NoArgConstructor
@NoArgConstructor
class AccountTransaction(
val amount: Amount = Amount.Zero,
val currency: String,

View File

@ -1,8 +1,10 @@
package net.codinux.banking.client.model
import net.codinux.banking.client.model.config.NoArgConstructor
import kotlin.jvm.JvmInline
@JvmInline
@NoArgConstructor
value class Amount(val amount: String = "0") {
companion object {

View File

@ -1,7 +1,9 @@
package net.codinux.banking.client.model
import kotlinx.datetime.LocalDate
import net.codinux.banking.client.model.config.NoArgConstructor
@NoArgConstructor
class BankAccount(
val identifier: String,
var accountHolderName: String,

View File

@ -1,5 +1,8 @@
package net.codinux.banking.client.model
import net.codinux.banking.client.model.config.NoArgConstructor
@NoArgConstructor
class CustomerAccount(
val bankCode: String,
var loginName: String,

View File

@ -1,4 +1,7 @@
package net.codinux.banking.client.model
import net.codinux.banking.client.model.config.NoArgConstructor
@NoArgConstructor
class UnbookedAccountTransaction {
}

View File

@ -0,0 +1,6 @@
package net.codinux.banking.client.model.config
/**
* Marker interface for Kotlin No-arg plugin so that No-arg plugin adds no-arg constructors to classes marked with this annotation.
*/
annotation class NoArgConstructor