Package com.storedobject.common
Class IBAN
java.lang.Object
com.storedobject.common.IBAN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Format an IBAN by inserting a space after every 4 positions from the left.static String
Insert check digits to the given set of IBAN fragments for a given country to generate a valid IBAN.static String
Insert check digits to the given set of IBAN fragments for a given country to generate a valid IBAN.static int
Get length of IBAN.static int
Get length of IBAN.static boolean
Validate a given IBAN.
-
Constructor Details
-
IBAN
public IBAN()
-
-
Method Details
-
validate
Validate a given IBAN. (For certain countries, the valid length is already coded (Seelength(Country)
) and for those countries length is also verified.)- Parameters:
iban
- IBAN (It could be a formatted IBAN too).- Returns:
- True if valid.
-
length
Get length of IBAN.- Parameters:
country
- Country- Returns:
- Length of IBAN for known countries. -1 is returned if unknown (or not yet coded here).
-2 is returned if
country
isnull
or for invalid country code.
-
length
Get length of IBAN.- Parameters:
country
- Country- Returns:
- Length of IBAN for known countries. -1 is returned if unknown (or not yet coded here).
-2 is returned if
country
isnull
.
-
generate
Insert check digits to the given set of IBAN fragments for a given country to generate a valid IBAN.- Parameters:
country
- CountryibanFragments
- Fragment of the IBAN. If the length of the IBAN for the given country is known and the total length of the fragments given is smaller in size, then, the last fragment will be left-padded with zeros.- Returns:
- A valid IBAN. If the
country
isnull
or if the total length of the IBAN fragments isnull
or too long, null is returned.
-
generate
Insert check digits to the given set of IBAN fragments for a given country to generate a valid IBAN.- Parameters:
country
- CountryibanFragments
- Fragment of the IBAN. If the length of the IBAN for the given country is known and the total length of the fragments given is smaller in size, then, the last fragment will be left-padded with zeros.- Returns:
- A valid IBAN. If the
country
isnull
or if the total length of the IBAN fragments isnull
or too long, null is returned.
-
format
-