Class Budget
java.lang.Object
no.idata1002.group19.domain.entity.Budget
Database entitytype representation of a budget.
Each user has a budget assigned to themselves, and the budget holds data regarding the period which the budget is supposed to be active, as well as a upper boundary for how much the user wants to spend. A budget has a one-to-many relationship with the transaction entity-type.
- Since:
- 16.04.2023
- Version:
- 17.04.2023
- Author:
- Group 19
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getBid()
Returns the id of budget.int
Returns the boundary of the budget.Returns the end date of the budget.Returns the start date of the budgetboolean
isValid()
Checks whether the budget has a valid start and end date.void
setBid
(long bid) Sets the id of budgetvoid
setBoundary
(int boundary) Sets boundary of the budget.void
setEndDate
(LocalDate endDate) Sets the end date of the budget.void
setStartDate
(LocalDate startDate) Sets the start date of the budget.
-
Constructor Details
-
Budget
Default constructor for budget- Parameters:
startDate
- start date of the budget. Format (yyyy-MM-dd)endDate
- end date of the budget. Format (yyyy-MM-dd)boundary
- the upper bound of the budget spendings.
-
Budget
public Budget()Empty constructor that is needed for JPA
-
-
Method Details
-
getBid
public long getBid()Returns the id of budget.- Returns:
- bid.
-
getStartDate
Returns the start date of the budget- Returns:
- startDate.
-
getEndDate
Returns the end date of the budget.- Returns:
- endDate.
-
setBid
public void setBid(long bid) Sets the id of budget- Parameters:
bid
- the bid that you want.
-
setStartDate
Sets the start date of the budget.- Parameters:
startDate
- the start date you want. Format (yyyy-MM-dd).
-
setEndDate
Sets the end date of the budget.- Parameters:
endDate
- the end date you want. Format (yyyy-MM-dd).
-
getBoundary
public int getBoundary()Returns the boundary of the budget.- Returns:
- boundary.
-
setBoundary
public void setBoundary(int boundary) Sets boundary of the budget.- Parameters:
setBoundary
- the end date you want. Format (yyyy-MM-dd).
-
isValid
public boolean isValid()Checks whether the budget has a valid start and end date. A budget is considered valid if both start and end dates are not null.- Returns:
- true if the budget is valid, false otherwise.
-