Class LoanManager

java.lang.Object
nl.minetopiasdb.api.LoanManager

public class LoanManager extends Object
Management class for loans
  • Constructor Details

    • LoanManager

      public LoanManager()
  • Method Details

    • getInstance

      public static LoanManager getInstance()
      Get an instance of LoanManager
      Returns:
      instance of loanmanager
    • create

      public CompletableFuture<Integer> create(UUID uuid, double amount)
      Create a loan in the database and returns a CompletableFuture containing the loan id.
      Parameters:
      uuid - uuid of the debtor
      amount - amount that has been loaned
      Returns:
      an instance of CompletableFuture containing the loan id.
    • setPaidOff

      public CompletableFuture<Integer> setPaidOff(int id, boolean paidOff)
      Mark a loan as paid off or not.
      Parameters:
      id - id of the loan
      paidOff - true if loan should now be marked as 'paid off'
      Returns:
      an instance of CompletableFuture containing the amount of modified rows, you can use this to check if the action was successful.
    • getLoanById

      public CompletableFuture<Loan> getLoanById(int id)
      Get a CompletableFuture containing a loan if found
      Parameters:
      id - id of loan
      Returns:
      an instance of CompletableFuture containing a loan if found
    • getLoans

      public CompletableFuture<List<Loan>> getLoans()
      Get a CompletableFuture with a list of all loans.
      Returns:
      an instance of CompletableFuture containing a list of loans
    • getLoans

      public CompletableFuture<List<Loan>> getLoans(UUID uuid)
      Get a CompletableFuture with a list of all loans for a specific debtor.
      Parameters:
      uuid - uuid of the debtor
      Returns:
      an instance of CompletableFuture containing a list of loans