From 045774ff3fae62c59b7339c2a018e249fa86172f Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 16 Sep 2024 17:45:30 +0200 Subject: [PATCH] Made collections val MutableList to be overridable with a derived collection class --- .../kotlin/net/codinux/banking/client/model/BankAccess.kt | 4 ++-- .../net/codinux/banking/client/model/BankAccount.kt | 6 +++--- .../net/codinux/banking/client/fints4k/FinTs4kMapper.kt | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/BankAccess.kt b/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/BankAccess.kt index 5138abc1..0e3d7830 100644 --- a/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/BankAccess.kt +++ b/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/BankAccess.kt @@ -44,7 +44,7 @@ open class BankAccess( * [selectedTanMethod] to get selected TanMethod or iterate over [tanMethods] and filter selected one by this id. */ var selectedTanMethodIdentifier: String? = null, - open var tanMethods: List = listOf(), + open val tanMethods: MutableList = mutableListOf(), /** * Identifier of selected TanMedium. @@ -53,7 +53,7 @@ open class BankAccess( * to get selected TanMedium or iterate over [tanMedia] and filter selected one by this medium name. */ var selectedTanMediumIdentifier: String? = null, - open var tanMedia: List = listOf(), + open val tanMedia: MutableList = mutableListOf(), var bankingGroup: BankingGroup? = null, open var serverAddress: String? = null, diff --git a/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/BankAccount.kt b/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/BankAccount.kt index 36ccd0a4..babde71a 100644 --- a/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/BankAccount.kt +++ b/BankingClientModel/src/commonMain/kotlin/net/codinux/banking/client/model/BankAccount.kt @@ -26,9 +26,9 @@ open class BankAccount( open var lastAccountUpdateTime: Instant? = null, var retrievedTransactionsFrom: LocalDate? = null, - open var bookedTransactions: List = emptyList(), - open var prebookedTransactions: List = emptyList(), - open var holdings: List = emptyList(), + open val bookedTransactions: MutableList = mutableListOf(), + open val prebookedTransactions: MutableList = mutableListOf(), + open val holdings: MutableList = mutableListOf(), var userSetDisplayName: String? = null, var displayIndex: Int = 0, diff --git a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt index 1273ba06..3d6ccfca 100644 --- a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt +++ b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kMapper.kt @@ -144,8 +144,8 @@ open class FinTs4kMapper { bank.accounts.map { mapAccount(it) }.sortedBy { it.type } .onEachIndexed { index, bankAccount -> bankAccount.displayIndex = index }, - bank.selectedTanMethod?.securityFunction?.code, bank.tanMethods.map { mapTanMethod(it) }, - bank.selectedTanMedium?.mediumName, bank.tanMedia.map { mapTanMedium(it) }, + bank.selectedTanMethod?.securityFunction?.code, bank.tanMethods.map { mapTanMethod(it) }.toMutableList(), + bank.selectedTanMedium?.mediumName, bank.tanMedia.map { mapTanMedium(it) }.toMutableList(), info?.bankingGroup ?: getBankingGroup(bank.bankName, bank.bic), bank.finTsServerAddress, @@ -163,8 +163,8 @@ open class FinTs4kMapper { mapMoney(account.balance), account.serverTransactionsRetentionDays, account.lastAccountUpdateTime, account.retrievedTransactionsFrom, - bookedTransactions = mapBookedTransactions(account), - holdings = mapHoldings(account.statementOfHoldings, account.currency, account.lastAccountUpdateTime) + bookedTransactions = mapBookedTransactions(account).toMutableList(), + holdings = mapHoldings(account.statementOfHoldings, account.currency, account.lastAccountUpdateTime).toMutableList() ) protected open fun mapAccountType(type: net.dankito.banking.client.model.BankAccountType): BankAccountType =