Class IbanAndBicValidator


  • public final class IbanAndBicValidator
    extends java.lang.Object
    Ein Klasse zum Validieren von IBAN und BIC Basierend auf code aus Forum http://www.tutorials.de/java/259520-iban-bic.html
    Version:
    1.0
    Author:
    takidoso / Frank Münster
    See Also:
    http://www.tutorials.de/java/259520-iban-bic.html
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BAD_IBAN_CHECKNUM
      Eingabe hat eine falsche Checksum, ist wahrscheinlich nicht gültig.
      static int EU_BIC
      Eingabe entspricht dem BIC Format mit gültiger EU Länderkennung, muss aber trotzdem keinen gültige BIC sein.
      static int EU_IBAN
      Eingabe ist gültige IBAn mit gültiger EU Länderkennung.
      static int GOOD_BIC
      Eingabe entspricht dem BIC Format.
      static int GOOD_IBAN
      Eingabe ist ein gültige IBAN.
      static int NOT_A_BIC
      Eingabe ist keine BIC.
      static int NOT_AN_IBAN
      Eingabe ist keine IBAN.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int isBIC​(java.lang.String bic)
      very simple formal check on given bic checks if the countrycode is correct or even european assumes that a bic is 11 or 8 characters long and an that the 4. and 5. offset is the country-code
      static int isIBAN​(java.lang.String iban)
      checks if the given IBAN seems to be an iban with countrycode-check and validates the checknumber if this validation is allright it is checked whether the country-code is sorts to european regulations payment area or not the higher the returned value the better the IBAN so if you just want to know if the IBAN is allright but don't care about the european-area you just do something like this: if (BankingNumberValidation.isIBAN(iban) >= GOOD_IBAN) { ... do something }
      static int isIBANCheckNumberOK​(java.lang.String iban)
      checks if the given IBAN seems to be an iban (without countrycode-check) and validates the checknumber this routine is a bit cheap but also fast since no country-codes are checked
      • Methods inherited from class java.lang.Object

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

      • NOT_AN_IBAN

        public static final int NOT_AN_IBAN
        Eingabe ist keine IBAN.
        See Also:
        Constant Field Values
      • BAD_IBAN_CHECKNUM

        public static final int BAD_IBAN_CHECKNUM
        Eingabe hat eine falsche Checksum, ist wahrscheinlich nicht gültig.
        See Also:
        Constant Field Values
      • GOOD_IBAN

        public static final int GOOD_IBAN
        Eingabe ist ein gültige IBAN.
        See Also:
        Constant Field Values
      • EU_IBAN

        public static final int EU_IBAN
        Eingabe ist gültige IBAn mit gültiger EU Länderkennung.
        See Also:
        Constant Field Values
      • GOOD_BIC

        public static final int GOOD_BIC
        Eingabe entspricht dem BIC Format. Muss aber keine gültige BIC sein.
        See Also:
        Constant Field Values
      • EU_BIC

        public static final int EU_BIC
        Eingabe entspricht dem BIC Format mit gültiger EU Länderkennung, muss aber trotzdem keinen gültige BIC sein.
        See Also:
        Constant Field Values
    • Method Detail

      • isIBANCheckNumberOK

        public static int isIBANCheckNumberOK​(java.lang.String iban)
        checks if the given IBAN seems to be an iban (without countrycode-check) and validates the checknumber this routine is a bit cheap but also fast since no country-codes are checked
        Parameters:
        iban - die zu Überprüfende IBAN
        Returns:
        (int) NOT_AN_IBAN , if given String does not matche basic IBAN-format BAD_IBAN_CHECKNUM , if basic IBAN-format is OK but not the checknumber GOOD_IBAN , if basic IBAN-format and hecknumber are OK
      • isIBAN

        public static int isIBAN​(java.lang.String iban)
        checks if the given IBAN seems to be an iban with countrycode-check and validates the checknumber if this validation is allright it is checked whether the country-code is sorts to european regulations payment area or not the higher the returned value the better the IBAN so if you just want to know if the IBAN is allright but don't care about the european-area you just do something like this: if (BankingNumberValidation.isIBAN(iban) >= GOOD_IBAN) { ... do something }
        Parameters:
        iban - iban die zu Überprüfende IBAN
        Returns:
        (int) NOT_AN_IBAN , if given String does not matche basic IBAN-format or countrycod is unkown BAD_IBAN_CHECKNUM , if basic IBAN-format and countrycode are OK but not the checknumber GOOD_IBAN , if basic IBAN-format, countrycode and checknumber are OK EU_IBAN , if basic IBAN-format, countrycode, checknumber are OK and the countrycode is european
        See Also:
        EUCountryCodes.isIbanEUCountry(String)
      • isBIC

        public static int isBIC​(java.lang.String bic)
        very simple formal check on given bic checks if the countrycode is correct or even european assumes that a bic is 11 or 8 characters long and an that the 4. and 5. offset is the country-code
        Parameters:
        bic - der geprueft werden soll.
        Returns:
        true, falls bic eine gueltige BIC zu sein scheint, false sonst.