Last active
November 19, 2018 12:21
-
-
Save BumpeiShimada/7b17cd046c1420833fdcea434a5407bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
public class DateEmptyValidator implements BaseValidator { | |
@Override | |
public void validate(EventForm form, List<String> errors) { | |
validateStartDate(form, errors); | |
validateEndDate(form, errors); | |
} | |
@Override | |
public ValidateType getValidateType() { | |
return ValidateType.ALL_EVENTS; | |
} | |
/** | |
* Ensure eventStartDate is not empty | |
*/ | |
private void validateStartDate(EventForm form, List<String> errors) { | |
String formStartTm = form.getEventStartDate(); | |
if (formStartTm.isEmpty()) { | |
errors.add("eventStartDate is empty"); | |
} | |
} | |
/** | |
* Ensure eventEndDate is not empty | |
*/ | |
private void validateEndDate(EventForm form, List<String> errors) { | |
String formEndTm = form.getEventEndDate(); | |
if (formEndTm.isEmpty()) { | |
errors.add("eventEndDate is empty"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment