Class ExpenseService

java.lang.Object
com.truebubo.maniflow.expense.ExpenseService
All Implemented Interfaces:
MoneyExchangeService<Expense>

@Service public class ExpenseService extends Object implements MoneyExchangeService<Expense>
Handles business logic behind expenses
  • Constructor Details

    • ExpenseService

      public ExpenseService(@NonNull ExpenseRepository expenseRepository)
      Service for expenses
      Parameters:
      expenseRepository - Repository for data about expenses
  • Method Details

    • get

      public List<Expense> get()
      Gets the list of all the expenses saved by the user
      Specified by:
      get in interface MoneyExchangeService<Expense>
      Returns:
      All the expenses saved
    • add

      public void add(@NonNull Expense expense)
      Saves the expense
      Specified by:
      add in interface MoneyExchangeService<Expense>
      Parameters:
      expense - Information about the expense to be added
    • change

      public void change(int id, @NonNull BigDecimal newAmount)
      Change the value on the expense with given id
      Specified by:
      change in interface MoneyExchangeService<Expense>
      Parameters:
      id - ID identifying the expense. It is the left value displayed when calling showExpenses
      newAmount - Will update the value to this value. If set to zero. The value will be removed