Class EmailDtoValidator
java.lang.Object
com.app.validate.EmailDtoValidator
-
Constructor Summary
ConstructorsConstructorDescriptionEmailDtoValidator
(String emailRegex) Constructs an EmailDtoValidator with the provided email regex pattern. -
Method Summary
-
Constructor Details
-
EmailDtoValidator
Constructs an EmailDtoValidator with the provided email regex pattern.- Parameters:
emailRegex
- regex pattern for validating email format
-
-
Method Details
-
validate
Validates the given EmailDto object. Checks if the DTO is null and if the email field matches the email regex pattern. Collects errors and throws ValidationException if any validation fails.- Specified by:
validate
in interfaceValidator<EmailDto>
- Parameters:
emailDto
- the EmailDto object to validate- Throws:
ValidationException
- if validation errors are found
-