diff --git a/src/main/java/com/andrewlalis/perfin/model/Account.java b/src/main/java/com/andrewlalis/perfin/model/Account.java index 6d73a35..f974117 100644 --- a/src/main/java/com/andrewlalis/perfin/model/Account.java +++ b/src/main/java/com/andrewlalis/perfin/model/Account.java @@ -8,9 +8,9 @@ import java.util.Currency; * credit-card, etc.). */ public class Account { - private long id; - private LocalDateTime createdAt; - private boolean archived; + private final long id; + private final LocalDateTime createdAt; + private final boolean archived; private AccountType type; private String accountNumber; @@ -27,14 +27,6 @@ public class Account { this.currency = currency; } - public Account(AccountType type, String accountNumber, String name, Currency currency) { - this.archived = false; - this.type = type; - this.accountNumber = accountNumber; - this.name = name; - this.currency = currency; - } - public AccountType getType() { return type; } diff --git a/src/main/java/com/andrewlalis/perfin/model/AccountEntry.java b/src/main/java/com/andrewlalis/perfin/model/AccountEntry.java index ee52323..fbf34e0 100644 --- a/src/main/java/com/andrewlalis/perfin/model/AccountEntry.java +++ b/src/main/java/com/andrewlalis/perfin/model/AccountEntry.java @@ -36,13 +36,13 @@ public class AccountEntry { DEBIT } - private long id; - private LocalDateTime timestamp; - private long accountId; - private long transactionId; - private BigDecimal amount; - private Type type; - private Currency currency; + private final long id; + private final LocalDateTime timestamp; + private final long accountId; + private final long transactionId; + private final BigDecimal amount; + private final Type type; + private final Currency currency; public AccountEntry(long id, LocalDateTime timestamp, long accountId, long transactionId, BigDecimal amount, Type type, Currency currency) { this.id = id; @@ -54,14 +54,6 @@ public class AccountEntry { this.currency = currency; } - public AccountEntry(long accountId, long transactionId, BigDecimal amount, Type type, Currency currency) { - this.accountId = accountId; - this.transactionId = transactionId; - this.amount = amount; - this.type = type; - this.currency = currency; - } - public long getId() { return id; } diff --git a/src/main/java/com/andrewlalis/perfin/model/AccountType.java b/src/main/java/com/andrewlalis/perfin/model/AccountType.java index 2de9ba3..79626d9 100644 --- a/src/main/java/com/andrewlalis/perfin/model/AccountType.java +++ b/src/main/java/com/andrewlalis/perfin/model/AccountType.java @@ -1,5 +1,8 @@ package com.andrewlalis.perfin.model; +/** + * Represents the different possible account types in Perfin. + */ public enum AccountType { CHECKING("Checking"), SAVINGS("Savings"), diff --git a/src/main/java/com/andrewlalis/perfin/model/Attachment.java b/src/main/java/com/andrewlalis/perfin/model/Attachment.java index 927cb41..282e86e 100644 --- a/src/main/java/com/andrewlalis/perfin/model/Attachment.java +++ b/src/main/java/com/andrewlalis/perfin/model/Attachment.java @@ -12,11 +12,11 @@ import java.time.format.DateTimeFormatter; * account balance record. */ public class Attachment { - private long id; - private LocalDateTime timestamp; - private String identifier; - private String filename; - private String contentType; + private final long id; + private final LocalDateTime timestamp; + private final String identifier; + private final String filename; + private final String contentType; public Attachment(long id, LocalDateTime timestamp, String identifier, String filename, String contentType) { this.id = id; @@ -26,13 +26,6 @@ public class Attachment { this.contentType = contentType; } - public Attachment(LocalDateTime timestamp, String identifier, String filename, String contentType) { - this.timestamp = timestamp; - this.identifier = identifier; - this.filename = filename; - this.contentType = contentType; - } - public long getId() { return id; } diff --git a/src/main/java/com/andrewlalis/perfin/model/BalanceRecord.java b/src/main/java/com/andrewlalis/perfin/model/BalanceRecord.java index f61db88..f5d795d 100644 --- a/src/main/java/com/andrewlalis/perfin/model/BalanceRecord.java +++ b/src/main/java/com/andrewlalis/perfin/model/BalanceRecord.java @@ -10,12 +10,12 @@ import java.util.Currency; * correct balance. */ public class BalanceRecord { - private long id; - private LocalDateTime timestamp; + private final long id; + private final LocalDateTime timestamp; - private long accountId; - private BigDecimal balance; - private Currency currency; + private final long accountId; + private final BigDecimal balance; + private final Currency currency; public BalanceRecord(long id, LocalDateTime timestamp, long accountId, BigDecimal balance, Currency currency) { this.id = id; @@ -25,12 +25,6 @@ public class BalanceRecord { this.currency = currency; } - public BalanceRecord(long accountId, BigDecimal balance, Currency currency) { - this.accountId = accountId; - this.balance = balance; - this.currency = currency; - } - public long getId() { return id; } diff --git a/src/main/java/com/andrewlalis/perfin/model/Transaction.java b/src/main/java/com/andrewlalis/perfin/model/Transaction.java index 6527987..d3704c7 100644 --- a/src/main/java/com/andrewlalis/perfin/model/Transaction.java +++ b/src/main/java/com/andrewlalis/perfin/model/Transaction.java @@ -16,7 +16,7 @@ public class Transaction { private final BigDecimal amount; private final Currency currency; - private String description; + private final String description; public Transaction(long id, LocalDateTime timestamp, BigDecimal amount, Currency currency, String description) { this.id = id; diff --git a/src/main/java/com/andrewlalis/perfin/model/history/AccountHistoryItem.java b/src/main/java/com/andrewlalis/perfin/model/history/AccountHistoryItem.java index 32a4fbb..4d1e4e1 100644 --- a/src/main/java/com/andrewlalis/perfin/model/history/AccountHistoryItem.java +++ b/src/main/java/com/andrewlalis/perfin/model/history/AccountHistoryItem.java @@ -9,10 +9,10 @@ import java.time.LocalDateTime; * record, or modifications to the account's properties. */ public class AccountHistoryItem { - private long id; - private LocalDateTime timestamp; - private long accountId; - private AccountHistoryItemType type; + private final long id; + private final LocalDateTime timestamp; + private final long accountId; + private final AccountHistoryItemType type; public AccountHistoryItem(long id, LocalDateTime timestamp, long accountId, AccountHistoryItemType type) { this.id = id; @@ -21,12 +21,6 @@ public class AccountHistoryItem { this.type = type; } - public AccountHistoryItem(LocalDateTime timestamp, long accountId, AccountHistoryItemType type) { - this.timestamp = timestamp; - this.accountId = accountId; - this.type = type; - } - public long getId() { return id; }