Package fr.marcwrobel.jbanking.creditor
Class CreditorIdentifier
- java.lang.Object
-
- fr.marcwrobel.jbanking.creditor.CreditorIdentifier
-
- All Implemented Interfaces:
Serializable
public class CreditorIdentifier extends Object implements Serializable
A Creditor Identifier (CI) Code as specified by the EPC.CI structure:
- Position 1-2 filled with the ISO country code.
- Position 3-4 filled with the check digit according to ISO 7064 Mod 97-10.
- Position 5-7 filled with the Creditor Business Code, if not used then filled with ZZZ.
- Position 8 onwards filled with the country specific part of the identifier being a national identifier of the Creditor, as defined by the National Community.
This class handles validation of the check digit and validation of the Creditor Identifier Structure described above without going into the validation of the national identifier.
Instances of this class are immutable and are safe for use by multiple concurrent threads.
- Author:
- Charles Kayser
- See Also:
- EPC Creditor Identifier Overview, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CreditorIdentifier(IsoCountry country, String businessCode, String creditorNationalId)Create a new Creditor Identifier from the given country code, the creditor business code and the creditor national id.CreditorIdentifier(String creditorId)Create a new creditor identifier from the given string.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StringgetBusinessCode()Extract the business code from this Creditor Identifier.StringgetCheckDigit()Extract the check digit from this Creditor Identifier.StringgetCountryCode()Extract the ISO 3166-1-alpha-2 country code from this Creditor Identifier.StringgetNationalIdentifier()Extract the creditor national identifier from this Creditor Identifier.inthashCode()static booleanisValid(String creditorIdentifier)Validates the given Creditor Identifier String.StringtoString()
-
-
-
Constructor Detail
-
CreditorIdentifier
public CreditorIdentifier(IsoCountry country, String businessCode, String creditorNationalId)
Create a new Creditor Identifier from the given country code, the creditor business code and the creditor national id.- Parameters:
country- A non-null IsoCountry.businessCode- A non-null String.creditorNationalId- A non-null String.- Throws:
IllegalArgumentException- if either the IsoCountry or BBAN is nullCreditorIdentifierFormatException- if a valid Creditor Identifier could not be calculated using the given IsoCountry, business code and creditor national id
-
CreditorIdentifier
public CreditorIdentifier(String creditorId)
Create a new creditor identifier from the given string.- Parameters:
creditorId- a non-null String.
-
-
Method Detail
-
isValid
public static boolean isValid(String creditorIdentifier)
Validates the given Creditor Identifier String.- Parameters:
creditorIdentifier- A String.- Returns:
trueif the given String is a valid Creditor Identifier,falseotherwise.
-
getCountryCode
public String getCountryCode()
Extract the ISO 3166-1-alpha-2 country code from this Creditor Identifier.- Returns:
- A non-null string representing this Creditor Identifier ISO 3166-1-alpha-2 country code.
-
getCheckDigit
public String getCheckDigit()
Extract the check digit from this Creditor Identifier.- Returns:
- A non-null string representing this Creditor Identifier check digit.
-
getBusinessCode
public String getBusinessCode()
Extract the business code from this Creditor Identifier.- Returns:
- A non-null string representing this Creditor Identifier business code.
-
getNationalIdentifier
public String getNationalIdentifier()
Extract the creditor national identifier from this Creditor Identifier.- Returns:
- A non-null string representing this Creditor Identifier National ID.
-
-