From 2681ef6acda4128b8af6566a7925eb041083bcbc Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Tue, 26 Nov 2019 23:58:15 +0200 Subject: [PATCH] LedgerTransactionAccount: add copy constructor --- .../mobileledger/model/LedgerTransactionAccount.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java index 1446be79..801e0169 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransactionAccount.java @@ -30,7 +30,7 @@ public class LedgerTransactionAccount { private String accountName; private String shortAccountName; private float amount; - private boolean amountSet; + private boolean amountSet = false; private String currency; public LedgerTransactionAccount(String accountName, float amount) { @@ -46,6 +46,13 @@ public class LedgerTransactionAccount { public LedgerTransactionAccount(String accountName) { this.accountName = accountName; } + public LedgerTransactionAccount(LedgerTransactionAccount origin) { + // copy constructor + setAccountName(origin.getAccountName()); + if (origin.isAmountSet()) + setAmount(origin.getAmount()); + currency = origin.getCurrency(); + } public String getAccountName() { return accountName; -- 2.39.5