53 lines
1.4 KiB
Java
53 lines
1.4 KiB
Java
package model;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.time.LocalDate;
|
|
|
|
public class LedgerEntry {
|
|
private final LocalDate date;
|
|
private final Long operationId;
|
|
private final Account account;
|
|
private final Category category;
|
|
private final BigDecimal deltaAmount;
|
|
|
|
public LedgerEntry(LocalDate date, Long operationId, Account account, Category category, BigDecimal deltaAmount) {
|
|
if (date == null) {
|
|
throw new IllegalArgumentException("Не указана дата движения");
|
|
}
|
|
|
|
if (operationId == null) {
|
|
throw new IllegalArgumentException("Не указан ID операции");
|
|
}
|
|
|
|
if (account == null) {
|
|
throw new IllegalArgumentException("Не указан счёт движения");
|
|
}
|
|
|
|
if (deltaAmount == null) {
|
|
throw new IllegalArgumentException("Не указана сумма движения");
|
|
}
|
|
|
|
this.date = date;
|
|
this.operationId = operationId;
|
|
this.account = account;
|
|
this.category = category;
|
|
this.deltaAmount = deltaAmount;
|
|
}
|
|
|
|
public BigDecimal getDeltaAmount() {
|
|
return deltaAmount;
|
|
}
|
|
|
|
public LocalDate getDate() {
|
|
return date;
|
|
}
|
|
|
|
public Account getAccount() {
|
|
return account;
|
|
}
|
|
|
|
public Long getOperationId() {
|
|
return operationId;
|
|
}
|
|
}
|