@Generated(value="org.jomc.tools.SourceFileProcessor 1.9", comments="See http://www.jomc.org/jomc/1.9/jomc-tools-1.9") public final class IBAN extends Object implements CharSequence, Comparable<IBAN>, Formattable, Serializable
The IBAN structure is defined in ISO 13616-1 and consists of a two-letter ISO 3166-1 country code, followed by two check digits and up to thirty alphanumeric characters for a BBAN (Basic Bank Account Number) which has a fixed length per country and, included within it, a bank identifier with a fixed position and a fixed length per country. The check digits are calculated based on the scheme defined in ISO/IEC 7064 (MOD97-10). The Society for Worldwide Interbank Financial Telecommunication SCRL, SWIFT, has been designated by the ISO Technical Management Board to act as the Registration Authority for ISO 13616. Nationally-agreed, ISO 13616-compliant IBAN formats are submitted to the registration authority exclusively by the National Standards Body or the National Central Bank of the country. For further information see the IBAN REGISTRY. An updated version of the document may be found at SWIFT.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_CHARACTERS
Maximum number of characters of an
IBAN . |
Modifier and Type | Method and Description |
---|---|
Appendable |
append(IbanFormat format,
Appendable appendable)
Formats an IBAN and appends the resulting text to a given
Appendable . |
char |
charAt(int index)
Returns the
char value at the specified index. |
int |
compareTo(IBAN o)
Compares this object with the specified object for order.
|
boolean |
equals(Object o)
Indicates whether some other object is equal to this one.
|
void |
formatTo(Formatter formatter,
int flags,
int width,
int precision)
Formats the object using the provided
Formatter . |
String |
getBankIdentifier()
Gets the bank identifier part of the BBAN of the IBAN.
|
String |
getBranchIdentifier()
Gets the branch identifier part of the BBAN of the IBAN.
|
String |
getCountryCode()
Gets the two-letter ISO 3166-1 country code identifying the country the IBAN belongs to.
|
static String[] |
getCountryCodes()
Gets an array holding two-letter ISO 3166-1 country codes of all countries that have implemented the IBAN
standard.
|
int |
hashCode()
Gets the hash code value of the object.
|
static boolean |
isIbanAlphabet(char c)
Checks a given character to belong to the IBAN alphabet.
|
boolean |
isSepaCountry()
Gets a flag indicating the country of the IBAN to be part of the jurisdictional scope of the Single Euro Payment
Area (SEPA) Schemes.
|
static boolean |
isSepaCountry(String countryCode)
Tests a given two-letter ISO 3166-1 country code to identify a country that is part of the jurisdictional scope
of the Single Euro Payment Area (SEPA) Schemes.
|
int |
length()
Returns the length of this character sequence.
|
static IBAN |
parse(String text)
Parses text from the beginning of the given string to produce an
IBAN instance. |
static IBAN |
parse(String text,
ParsePosition pos)
Parses text from a string to produce an
IBAN instance. |
static IBAN |
parse(String countryCode,
String bban)
Parses text from a BBAN string to produce an
IBAN instance. |
static boolean |
peekIban(String text)
Parses text from a string to peek at a national
IBAN format. |
CharSequence |
subSequence(int start,
int end)
Returns a new
CharSequence that is a subsequence of this sequence. |
String |
toString()
Gets a string representation of the object.
|
String |
toString(IbanFormat format)
Formats an IBAN to produce a string.
|
static IBAN |
valueOf(String text)
Parses text from the beginning of the given string to produce an
IBAN instance. |
static IBAN |
valueOf(String countryCode,
String bban)
Parses text from a BBAN string to produce an
IBAN instance. |
public static final int MAX_CHARACTERS
IBAN
.public static String[] getCountryCodes()
public static boolean isSepaCountry(String countryCode)
countryCode
- The two-letter ISO 3166-1 country code to test.true
, if the country identified by countryCode
is part of the jurisdictional scope of the
Single Euro Payment Area (SEPA) Schemes; false
, if not.NullPointerException
- if countryCode
is null
.getCountryCodes()
public String getCountryCode()
getCountryCodes()
public boolean isSepaCountry()
true
, if the country of the IBAN is part of the jurisdictional scope of the Single Euro Payment
Area (SEPA) Schemes; false
, else.getCountryCode()
,
isSepaCountry(java.lang.String)
public String getBankIdentifier()
null
.public String getBranchIdentifier()
null
.public static IBAN parse(String countryCode, String bban) throws IbanSyntaxException
IBAN
instance.countryCode
- The two-letter ISO 3166-1 country code of the IBAN to create.bban
- A string to parse BBAN characters from.NullPointerException
- if countryCode
or bban
is null
.IllegalArgumentException
- if the country identified by countryCode
has not implemented the IBAN
standard, that is, countryCode
is not contained in the array returned by method getCountryCodes
.IbanSyntaxException
- if the parse fails or the length of bban
is invalid.getCountryCodes()
,
valueOf(java.lang.String, java.lang.String)
public static IBAN parse(String text, ParsePosition pos) throws IbanCheckDigitsException
IBAN
instance.
The method attempts to parse text starting at the index given by pos
. If parsing succeeds, then the
index of pos
is updated to the index after the last character used (parsing does not necessarily use all
characters up to the end of the string), and the parsed value is returned. The updated pos
can be used to
indicate the starting point for the next call to this method.
text
- A string to parse IBAN characters from.pos
- A ParsePosition
object with index and error index information as described above.null
, if the parse fails.NullPointerException
- if text
or pos
is null
.IbanCheckDigitsException
- if check digits validation of the parsed value fails.public static IBAN parse(String text) throws IbanSyntaxException, IbanCheckDigitsException
IBAN
instance.
Unlike the parse(String, ParsePosition)
method this method throws an IbanSyntaxException
if
text
cannot be parsed or is of invalid length.
text
- A string to parse IBAN characters from.NullPointerException
- if text
is null
.IbanSyntaxException
- if the parse fails or the length of text
is invalid.IbanCheckDigitsException
- if check digits validation of the parsed value fails.valueOf(java.lang.String)
public static IBAN valueOf(String text)
IBAN
instance.
Unlike the parse(String)
method this method throws an IllegalArgumentException
if
text
cannot be parsed, is of invalid length or check digits validation fails.
text
- A string to parse IBAN characters from.NullPointerException
- if text
is null
.IllegalArgumentException
- if the parse fails, the length of text
is invalid or if check digits
validation of the parsed value fails.parse(java.lang.String)
public static IBAN valueOf(String countryCode, String bban)
IBAN
instance.
Unlike the parse(String, String)
method this method throws an IllegalArgumentException
if the
parse fails or the length of bban
is invalid.
countryCode
- The two-letter ISO 3166-1 country code of the IBAN to create.bban
- A string to parse BBAN characters from.NullPointerException
- if countryCode
or bban
is null
.IllegalArgumentException
- if the country identified by countryCode
has not implemented the IBAN
standard, that is, countryCode
is not contained in the array returned by method getCountryCodes
,
if the parse fails, or if the length of bban
is invalid.parse(java.lang.String, java.lang.String)
public static boolean isIbanAlphabet(char c)
c
- The character to check.true
if c
is a character of the IBAN alphabet; false
, else.public static boolean peekIban(String text) throws IbanCheckDigitsException
IBAN
format.
This method peeks at the given string to test whether it denotes a possibly valid national IBAN format.
text
- A string to peek at.true
, if text
denotes a (possibly partially) valid national IBAN format; false
,
if text
does not denote a valid national IBAN format.NullPointerException
- if text
is null
.IbanCheckDigitsException
- if check digits validation fails.public Appendable append(IbanFormat format, Appendable appendable) throws IOException
Appendable
.format
- The format to use.appendable
- The Appendable
to append the formatted IBAN to.appendable
.NullPointerException
- if format
or appendable
is null
.IOException
- if appending fails.public String toString(IbanFormat format)
format
- The format to use.NullPointerException
- if format
is null
.public void formatTo(Formatter formatter, int flags, int width, int precision)
Formatter
.
This method uses the ELECTRONIC
format by default. The PRINT
format can be used by specifying
the alternate form flag (#
) in a format specifier.
formatTo
in interface Formattable
formatter
- The Formatter
.flags
- The flags to modify the output format.width
- The minimum number of characters to be written to the output.precision
- The maximum number of characters to be written to the output.IllegalFormatFlagsException
- if the UPPERCASE
flag is set.public int length()
The length is the number of 16-bit char
s in the sequence.
length
in interface CharSequence
char
s in this sequence.public char charAt(int index)
char
value at the specified index.
An index ranges from zero to length() - 1
. The first char
value of the sequence is at index
zero, the next at index one, and so on, as for array indexing.
If the char
value specified by the index is a surrogate, the surrogate value is returned.
charAt
in interface CharSequence
index
- The index of the char
value to return.char
value at index
.IndexOutOfBoundsException
- if index
is negative or not less than the length of the character
sequence.length()
public CharSequence subSequence(int start, int end)
CharSequence
that is a subsequence of this sequence.
The subsequence starts with the char
value at the specified index and ends with the char
value
at index end - 1
. The length (in char
s) of the returned sequence is end - start
, so if
start == end
then an empty sequence is returned.
subSequence
in interface CharSequence
start
- The start index, inclusive.end
- The end index, exclusive.start
up to end -1
.IndexOutOfBoundsException
- if start
or end
are negative, if end
is greater than
the length of the character sequence, or if start
is greater than end
.public int hashCode()
public String toString()
toString
in interface CharSequence
toString
in class Object
public int compareTo(IBAN o)
IBAN comparison respects the national IBAN formats when comparing IBANs of the same country. Any country codes and check digits are ignored.
compareTo
in interface Comparable<IBAN>
o
- The Object to be compared.NullPointerException
- if o
is null
.Copyright © 2013–2017 jDTAUS. All rights reserved.