Class MobileNumberValidator

  • All Implemented Interfaces:
    org.springframework.validation.Validator

    @Component("mobileNumberValidator")
    public class MobileNumberValidator
    extends java.lang.Object
    implements org.springframework.validation.Validator
    Verify the mobile number before binding and unbinding.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean isVerificationCodeExpired​(java.util.Date date)
      Check the verification code is expired.
      boolean supports​(java.lang.Class<?> clazz)  
      void validate​(java.lang.Object object, org.springframework.validation.Errors errors)  
      protected void validateMobileNumber​(java.lang.String mobileNumber, org.springframework.validation.Errors errors)
      Verify the binding mobile number before saving.
      protected void validateVerificationCode​(java.lang.String verificationCode, java.lang.String key, org.springframework.validation.Errors errors)
      Verify the verification code before saving.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MobileNumberValidator

        public MobileNumberValidator()
    • Method Detail

      • supports

        public boolean supports​(java.lang.Class<?> clazz)
        Specified by:
        supports in interface org.springframework.validation.Validator
      • validate

        public void validate​(java.lang.Object object,
                             org.springframework.validation.Errors errors)
        Specified by:
        validate in interface org.springframework.validation.Validator
      • validateMobileNumber

        protected void validateMobileNumber​(java.lang.String mobileNumber,
                                            org.springframework.validation.Errors errors)
        Verify the binding mobile number before saving.
      • validateVerificationCode

        protected void validateVerificationCode​(java.lang.String verificationCode,
                                                java.lang.String key,
                                                org.springframework.validation.Errors errors)
        Verify the verification code before saving.
      • isVerificationCodeExpired

        protected boolean isVerificationCodeExpired​(java.util.Date date)
        Check the verification code is expired.
        Parameters:
        date - The time when verification code was creating.
        Returns:
        whether is expired.