Interface DebtRepository

All Known Implementing Classes:
MongoDebtRepository

@Repository public interface DebtRepository
Interface used for dealing with storage and retrieval of debt
  • Method Details

    • saveDebt

      Debt saveDebt(@NonNull Debt debt)
      Saves the debt to storage
      Parameters:
      debt - Debt saved
      Returns:
      debt saved
    • getDebt

      Optional<Debt> getDebt(int id)
      Finds the debt with given id
      Parameters:
      id - ID as shown in showDebts
      Returns:
      Debt if found otherwise empty
    • getDebts

      List<Debt> getDebts()
      Finds all the current debt
      Returns:
      List of all the debts saved
    • changeDebt

      Optional<Debt> changeDebt(int id, @NonNull BigDecimal newAmount)
      Changes the debt with given id
      Parameters:
      id - ID identifying the debt. It is the left value displayed when calling showExpenses
      newAmount - Will update the value to this value. If set to zero. The debt will be erased
      Returns:
      Value of new debt or empty if not exist