boolean matches = input.matches(withoutSecondsPattern);
if(!matches) {
if(secondsAllowed) {
matches = input.matches(withSecondsPattern);
if(!matches)
return new ValidatorAlgorithmResult(NOT_A_VALID_TIME_WITH_SECONDS_OPTIONALLY, input);
else
return null;
}
return new ValidatorAlgorithmResult(NOT_A_VALID_TIME_WITHOUT_SECONDS, input);
}
return boundsCheck(input);
}
if(secondsRequired) {
boolean matches = input.matches(withSecondsPattern);
if(!matches) {
return new ValidatorAlgorithmResult(NOT_A_VALID_TIME_WITH_SECONDS_REQUIRED, input);
}
}
return boundsCheck(input);