Class CreateHolidayDtoValidator
java.lang.Object
com.app.validate.CreateHolidayDtoValidator
- All Implemented Interfaces:
Validator<CreateHolidayDto>
@Component
public class CreateHolidayDtoValidator
extends Object
implements Validator<CreateHolidayDto>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
validate
(CreateHolidayDto createHolidayDto) Validates the CreateHolidayDto object by checking: - If the DTO is null
-
Constructor Details
-
CreateHolidayDtoValidator
public CreateHolidayDtoValidator()
-
-
Method Details
-
validate
Validates the CreateHolidayDto object by checking: - If the DTO is null. - If the start date is null. - If the end date is null. - If the start date is after the end date. If any validation rule is violated, a ValidationException is thrown containing all error messages.- Specified by:
validate
in interfaceValidator<CreateHolidayDto>
- Parameters:
createHolidayDto
- The DTO containing holiday start and end dates- Throws:
ValidationException
- if any validation error is found
-