Class GoalValidator
java.lang.Object
org.ntnu.idi.idatt2106.sparesti.sparestibackend.validation.ObjectValidator<GoalCreateDTO>
org.ntnu.idi.idatt2106.sparesti.sparestibackend.validation.goal.GoalValidator
Validator class for fields in GoalCreateDTO
- Since:
- 29.4.24
- Version:
- 1.0
- Author:
- Harry L.X
-
Field Summary
Fields inherited from class org.ntnu.idi.idatt2106.sparesti.sparestibackend.validation.ObjectValidator
validator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
validate
(GoalCreateDTO dto) Validation method for dto field constraints.void
validateGoalIds
(List<Long> distinctGoalIds, List<Long> activeGoalIds) Validates that list of goal Id's for priority sorting match the active goal Id'sMethods inherited from class org.ntnu.idi.idatt2106.sparesti.sparestibackend.validation.ObjectValidator
checkConstraints
-
Constructor Details
-
GoalValidator
public GoalValidator()
-
-
Method Details
-
validate
Validation method for dto field constraints. In addition, also checks that saved amount cannot be greater than target amount.- Overrides:
validate
in classObjectValidator<GoalCreateDTO>
- Parameters:
dto
- Object of type T- Throws:
BadInputException
- If saved amount is greater than target
-
validateGoalIds
Validates that list of goal Id's for priority sorting match the active goal Id's- Parameters:
distinctGoalIds
- Goal Id's with new sorting orderactiveGoalIds
- Active goal Id's
-