org.vfdtech.validators.PhoneValidator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utilities-and-generic-tools Show documentation
Show all versions of utilities-and-generic-tools Show documentation
A utilities service with generic tools implementation. Can be
plugged into your java project
package org.vfdtech.validators;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import org.vfdtech.annotations.ValidPhone;
import org.vfdtech.implementations.PhoneNumberUtils;
import org.vfdtech.interfaces.IPhoneNumberUtils;
public class PhoneValidator implements ConstraintValidator {
private final IPhoneNumberUtils iPhoneNumberUtils;
PhoneValidator(){
iPhoneNumberUtils = new PhoneNumberUtils();
}
@Override
public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
return iPhoneNumberUtils.isValid(s);
}
}