Class IBANValidator

  • All Implemented Interfaces:
    jakarta.validation.ConstraintValidator<IBAN,​CharSequence>

    public final class IBANValidator
    extends Object
    implements jakarta.validation.ConstraintValidator<IBAN,​CharSequence>
    IBAN (International Bank Account Number) Check Digit calculation/validation.

    This routine is based on the ISO 7064 Mod 97,10 check digit caluclation routine.

    The two check digit characters in a IBAN number are the third and fourth characters in the code. For check digit calculation/validation the first four characters are moved to the end of the code. So CCDDnnnnnnn becomes nnnnnnnCCDD (where CC is the country code and DD is the check digit). For check digit calcualtion the check digit value should be set to zero (i.e. CC00nnnnnnn in this example.

    For further information see Wikipedia - IBAN number.

    • Constructor Detail

      • IBANValidator

        public IBANValidator()
    • Method Detail

      • isValid

        public boolean isValid​(CharSequence code,
                               jakarta.validation.ConstraintValidatorContext context)
        Specified by:
        isValid in interface jakarta.validation.ConstraintValidator<IBAN,​CharSequence>
      • initialize

        public void initialize​(IBAN iban)
        Specified by:
        initialize in interface jakarta.validation.ConstraintValidator<IBAN,​CharSequence>