Pololei API reference — 1.0.0-rc01
This reference and its quickstart describe the release 1.0.0-rc01. The examples use the same English API names as the JavaDoc and require no application framework.
| Item | Pinned value |
|---|---|
| Release version | 1.0.0-rc01 |
| Source commit | 4981adaf9bba7ff1ce09c8d6afd521d19309c450 |
| Maven artifact version used below | 1.0.0-rc01 (Maven Central) |
| Documentation revision | 1, 2026-11-03 |
| Java / Maven used to verify the quickstart | Temurin 21.0.12.1 / Apache Maven 3.9.9 |
| Country data | SWIFT IBAN Registry Release 100 (89 countries) |
| EPC QR code | EPC069-12, versions 001 and 002 |
| SEPA Creditor Identifier | EPC262-08 |
| GWT | 2.13 (built and tested with 2.13.1) |
1.0.0-rc01 is a release candidate published to Maven Central. The quickstart resolves all pololei artifacts from there; it needs no pololei source checkout and no local build of the library.
Keep this file as the reference for release 1.0.0-rc01. Each release gets its own file docs/api/<version>.md; update the README link with it. Source links below are repository-relative; inspect them in the tag 1.0.0-rc01 when comparing against a newer checkout.
- Reproducible quickstart
- Artifacts and entry points
- IBAN reference
- BBAN and country data reference
- National check digits
- BIC reference
- EPC QR code reference
- SEPA Creditor Identifier reference
- Validation and error handling
- GWT, serialization and thread safety
- Complete generated JavaDoc
- Troubleshooting
Reproducible quickstart
The quickstart parses and validates IBANs, checks national check digits, creates an IBAN, validates a BBAN field and a BIC, and creates an EPC QR code payload and a SEPA Creditor Identifier. All inputs and artifact and Maven plugin versions are fixed, so the output is the same on every machine. The values are the public examples of the SWIFT registry, the EPC and the Deutsche Bundesbank; do not use them for real payments.
1. Prepare the project directory
Requirements: JDK 21, Maven 3.9.9, and a POSIX shell with mktemp (Linux or macOS). The first Maven build needs network access to download the pololei artifacts from Maven Central. pololei has no runtime dependencies and never needs a network connection at runtime.
All shell steps in this quickstart use the same terminal session.
set -eu
java -version
mvn -version
POLOLEI_QUICKSTART_DIR=$(mktemp -d "${TMPDIR:-/tmp}/pololei-quickstart.XXXXXX")
mkdir -p "$POLOLEI_QUICKSTART_DIR/app/src/main/java/example"
cd "$POLOLEI_QUICKSTART_DIR/app"
Keep the printed temporary directory path if you want to return to the example later; echo "$POLOLEI_QUICKSTART_DIR" shows it.
2. Create the application POM
Save the following as pom.xml in the app directory created above. The application has no parent POM and uses the exact release version 1.0.0-rc01 from Maven Central.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>pololei-quickstart</artifactId>
<version>1.0.0</version>
<properties>
<maven.compiler.release>21</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>io.github.nalukit</groupId>
<artifactId>pololei</artifactId>
<version>1.0.0-rc01</version>
</dependency>
<dependency>
<groupId>io.github.nalukit</groupId>
<artifactId>pololei-epc</artifactId>
<version>1.0.0-rc01</version>
</dependency>
<dependency>
<groupId>io.github.nalukit</groupId>
<artifactId>pololei-creditor</artifactId>
<version>1.0.0-rc01</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.0</version>
</plugin>
</plugins>
</build>
</project>
3. Create the application
Save this complete class as src/main/java/example/Quickstart.java in the same app directory. No imports or helper objects are omitted.
package example;
import io.github.nalukit.pololei.Bban;
import io.github.nalukit.pololei.Bic;
import io.github.nalukit.pololei.Iban;
import io.github.nalukit.pololei.IbanValidator;
import io.github.nalukit.pololei.NationalCheckMode;
import io.github.nalukit.pololei.ValidationResult;
import io.github.nalukit.pololei.creditor.CreditorIdentifier;
import io.github.nalukit.pololei.epc.EpcQrPayload;
import io.github.nalukit.pololei.error.IbanError;
import io.github.nalukit.pololei.registry.BbanField;
import java.math.BigDecimal;
public final class Quickstart {
public static void main(String[] args) {
// parse: whitespace and lower case letters are accepted
Iban iban = Iban.parse("de89 3704 0044 0532 0130 00");
System.out.println("IBAN: " + iban + " / " + iban.toPrintFormat());
System.out.println("fields: bank " + iban.bankIdentifier().orElseThrow()
+ ", account " + iban.field(BbanField.ACCOUNT_NUMBER).orElseThrow()
+ ", SEPA " + iban.isSepa());
// validate without exceptions
ValidationResult<Iban, IbanError> invalid = Iban.validate("DE88 3704 0044 0532 0130 00");
System.out.println("invalid: " + invalid.error().orElseThrow() + " - " + invalid.message().orElseThrow());
// national check digits (French RIB key)
IbanValidator validator = IbanValidator.standard()
.nationalCheck(NationalCheckMode.IF_SUPPORTED);
String wrongRibKey = "FR8420041010050500013M02607";
System.out.println("national: " + validator.validate(wrongRibKey).error().orElseThrow()
+ ", Iban.isValid=" + Iban.isValid(wrongRibKey));
// create an IBAN, calculating IBAN and national check digits
Iban built = Iban.builder()
.countryCode("FR")
.bankIdentifier("20041")
.branchIdentifier("01005")
.field(BbanField.ACCOUNT_NUMBER, "0500013M026")
.nationalCheckDigits(true)
.build();
System.out.println("built: " + built + ", national check "
+ validator.validate(built.toString()).nationalCheck());
// validate a single BBAN field
var field = Bban.validateField("DE", BbanField.BANK_IDENTIFIER, "3704004X");
System.out.println("field: " + field.error().orElseThrow() + " at position "
+ field.position().orElseThrow());
// BIC
Bic bic = Bic.parse("DEUTDEFF500");
System.out.println("BIC: " + bic + ", primary office " + bic.primaryOffice()
+ ", branch " + bic.branchCode().orElseThrow());
// EPC QR code payload (module pololei-epc)
EpcQrPayload payload = EpcQrPayload.builder()
.beneficiaryName("Red Cross of Belgium")
.iban(Iban.parse("BE72000000001616"))
.bic(Bic.parse("BPOTBEB1"))
.amount(new BigDecimal("1.00"))
.remittanceText("Urgency fund")
.build();
System.out.println("EPC: " + payload.lines().size() + " lines, " + payload.byteLength()
+ " bytes, " + payload.lines().get(7));
// SEPA Creditor Identifier (module pololei-creditor)
CreditorIdentifier ci = CreditorIdentifier.of("DE", null, "09999999999");
System.out.println("CI: " + ci + ", same creditor as A1B: "
+ ci.withBusinessCode("A1B").isSameCreditor(ci));
}
}
4. Compile and run
Still in the app directory:
mvn -B -ntp compile \
org.apache.maven.plugins:maven-dependency-plugin:3.7.0:copy-dependencies \
-DincludeScope=runtime
java -cp 'target/classes:target/dependency/*' example.Quickstart
Expected standard output (JVM diagnostics may additionally appear on standard error):
IBAN: DE89370400440532013000 / DE89 3704 0044 0532 0130 00
fields: bank 37040044, account 0532013000, SEPA true
invalid: INVALID_CHECK_DIGITS - check digits 88 are not valid
national: INVALID_NATIONAL_CHECK_DIGITS, Iban.isValid=true
built: FR1420041010050500013M02606, national check PASSED
field: INVALID_BBAN at position 8
BIC: DEUTDEFF500, primary office DEUTDEFF, branch 500
EPC: 11 lines, 80 bytes, EUR1
CI: DE98ZZZ09999999999, same creditor as A1B: true
orElseThrow() terminates the process with an exception if a result differs from the expected one. Once the application is compiled and the dependencies have been copied, the java command also works without network access.
Artifacts and entry points
All pololei artifacts use group ID io.github.nalukit and the same version 1.0.0-rc01.
| Artifact | Entry points and role |
|---|---|
pololei | Iban, IbanBuilder, IbanValidator, Bban, IbanFormat, Bic, ValidationResult, error types, IbanCheckDigits, NationalChecks, IbanRegistry; no runtime dependencies |
pololei-gwt | The pololei sources, the GWT module io.github.nalukit.pololei.Pololei and the GWT-RPC serializers; use it instead of pololei in GWT applications |
pololei-epc | EpcQrPayload: EPC QR code (GiroCode) payloads; JVM and GWT module io.github.nalukit.pololei.epc.PololeiEpc |
pololei-creditor | CreditorIdentifier: SEPA Creditor Identifier; JVM and GWT module io.github.nalukit.pololei.creditor.PololeiCreditor |
| Package | Content |
|---|---|
io.github.nalukit.pololei | Iban, IbanBuilder, IbanValidator, Bban, IbanFormat, Bic, ValidationResult, NationalCheckMode, NationalCheckStatus |
io.github.nalukit.pololei.error | IbanError, BicError, InvalidIbanException, InvalidBicException |
io.github.nalukit.pololei.checkdigit | IbanCheckDigits (ISO 7064 MOD 97-10) |
io.github.nalukit.pololei.national | NationalChecks, NationalCheck, NationalCheckOutcome |
io.github.nalukit.pololei.registry | IbanRegistry, IbanCountry, BbanStructure, BbanSegment, BbanLayout, BbanFieldDefinition, BbanField, BbanRange, CharacterType |
io.github.nalukit.pololei.epc | EpcQrPayload, EpcQrPayload.Builder, EpcQrPayload.Version, EpcQrPayload.CharacterSet |
io.github.nalukit.pololei.creditor | CreditorIdentifier, CreditorIdentifierError, InvalidCreditorIdentifierException |
io.github.nalukit.pololei.internal | Helpers, not part of the API |
On the module path, pololei is the automatic module io.github.nalukit.pololei, pololei-epc is io.github.nalukit.pololei.epc and pololei-creditor is io.github.nalukit.pololei.creditor. pololei-gwt is meant for the classpath. The generated JavaDoc includes all public types; the internal package and the GWT-RPC serializers are implementation infrastructure rather than application entry points.
IBAN reference
The entry point is io.github.nalukit.pololei.Iban. An Iban is immutable and always valid by the international rules: structure of the SWIFT registry and IBAN check digits.
Parsing and validation
| Signature | Result / behavior |
|---|---|
static Iban parse(CharSequence input) | Parses; accepts whitespace and lower case letters; throws InvalidIbanException |
static Iban parse(CharSequence input, IbanFormat format) | Input must be exactly in the given format (ELECTRONIC or PRINT) |
static Optional<Iban> tryParse(CharSequence input) | Empty for invalid input; never throws, accepts null |
static boolean isValid(CharSequence input) | Never throws, accepts null |
static ValidationResult<Iban, IbanError> validate(CharSequence input) | Valid result with the IBAN, or error with message and details; never throws |
static ValidationResult<Iban, IbanError> validate(CharSequence input, IbanFormat format) | Same with an exact format; INVALID_FORMAT if the input differs |
Iban checks the international rules only. Use an IbanValidator to check national check digits as well.
Creation
| Signature | Result / behavior |
|---|---|
static Iban of(String countryCode, String bban) | Calculates the IBAN check digits |
static IbanBuilder builder() | Builder from country code and BBAN parts |
static Iban random(Random random) | Test data, random country; no national check digits |
static Iban random(String countryCode, Random random) | Test data for the given country; no national check digits |
IbanBuilder methods return the same builder:
| Builder method | Purpose |
|---|---|
countryCode(String) | Country of the IBAN; required |
bban(String) | The complete BBAN |
bankIdentifier(String), branchIdentifier(String) | Registry parts |
accountNumber(String) | All BBAN positions outside bank and branch identifier |
field(BbanField field, String value) | One national BBAN field, see BBAN fields |
padBankIdentifier(boolean), padBranchIdentifier(boolean), padAccountNumber(boolean) | Left-pads a short part to its length |
paddingCharacter(char) | Character used for padding; default 0 |
nationalCheckDigits(boolean) | Calculates the national check digits with the built-in rule of the country |
Iban build() | Creates the IBAN and calculates its check digits |
Iban buildRandom(Random random) | Keeps the given parts and fills the missing ones at random |
The BBAN is described in one of three ways, which cannot be mixed: the complete bban(...), the registry parts (bankIdentifier, branchIdentifier and accountNumber), or the national field(...)s. build() throws an InvalidIbanException if a part is missing or does not fit and an IllegalStateException if the BBAN is described in more than one way. A builder without any BBAN part reports the first missing field in BBAN order. padAccountNumber(true) with accountNumber(...) rejects a short value where the remaining positions contain more than the account number (for example IT, ES, FR); use field(BbanField.ACCOUNT_NUMBER, ...) there.
Accessors and formatting
| Signature | Result / behavior |
|---|---|
String countryCode(), String checkDigits(), String bban() | The parts of the IBAN |
Optional<String> bankIdentifier() | Bank identifier as defined by the SWIFT registry |
Optional<String> branchIdentifier() | Branch identifier as defined by the SWIFT registry |
String accountNumber() | All BBAN characters outside bank and branch identifier (registry view) |
Optional<String> field(BbanField field) | One national BBAN field; empty if the country does not define it |
Map<BbanField, String> fields() | All national fields in BBAN order |
IbanCountry country(), boolean isSepa() | Registry definition and SEPA membership of the country |
String format(IbanFormat format) | ELECTRONIC (no spaces) or PRINT (groups of four) |
String toPrintFormat(), String toString() | Print format and electronic format |
accountNumber(), bankIdentifier() and branchIdentifier() follow the SWIFT IBAN registry on purpose. For AL, DJ, EE, FO, HU, MR, PL, SE, TL, TR and XK, field(ACCOUNT_NUMBER) no longer contains the national check digits (or, for TR, the reserved position); they are separate fields.
IbanCheckDigits.calculate(String countryCode, String bban) returns the two IBAN check digits and IbanCheckDigits.isValid(String iban) checks them for an IBAN in electronic format.
BBAN and country data reference
Bban validates a BBAN or one of its fields without building an IBAN, for example to check form fields one by one:
| Signature | Result / behavior |
|---|---|
static ValidationResult<String, IbanError> validate(String countryCode, String bban) | Validates the BBAN structure; the value is the normalized BBAN |
static ValidationResult<String, IbanError> validateField(String countryCode, BbanField field, CharSequence value) | Validates one field; UNDEFINED_FIELD if the country does not have it |
Positions count the characters of what was validated; add 4 to a BBAN position to get the IBAN position. National check digits are only checked for their structure here.
IbanRegistry provides the generated country data:
| Signature | Result / behavior |
|---|---|
static Optional<IbanCountry> find(String code) | Country definition; country codes are upper case |
static boolean isSupported(String code) | Whether the country uses IBAN |
static List<IbanCountry> countries() | All countries, ordered by country code |
static String source() | SWIFT IBAN Registry Release 100 |
| Type | Main members |
|---|---|
IbanCountry | countryCode(), countryName(), bbanStructure(), bbanLength(), ibanLength(), accountNumberLength(), bankIdentifier(), branchIdentifier() (Optional<BbanRange>), bbanLayout(), isSepa(), ibanExample(), isAccountPosition(int) |
BbanStructure | segments(), length(), typeAt(int), matches(CharSequence), indexOfMismatch(CharSequence), random(Random); toString() is the registry notation, e.g. 8!n10!n |
BbanSegment | Record (length, type) |
BbanLayout | fields(), find(BbanField), contains(BbanField), fieldAt(int), isSupplemented(), source() |
BbanFieldDefinition | Record (field, range), length() |
BbanRange | Record (start, end), 1-based and inclusive; length(), contains(int), extract(String bban) |
BbanField | BANK_IDENTIFIER, BANK_IDENTIFIER_EXTENSION, BRANCH_IDENTIFIER, ACCOUNT_NUMBER, NATIONAL_CHECK_DIGITS, ACCOUNT_TYPE, OWNER_ACCOUNT_TYPE, IDENTIFICATION_NUMBER, CURRENCY, RESERVED; label() |
CharacterType | DIGITS (n), UPPER_CASE_LETTERS (a), ALPHANUMERIC (c); fromCode(char), code(), matches(char), randomChar(Random) |
BbanLayout.isSupplemented() is true where pololei adds national fields that the registry does not describe; source() names the source. See docs/bban-fields.md for the fields of each country and docs/registry-audit.md for the provenance of the data.
National check digits
IbanValidator is an immutable, configurable IBAN validator. Configure it once and share it; each configuration method returns a new validator.
| Signature | Result / behavior |
|---|---|
static IbanValidator standard() | International rules only, any accepted format, NationalCheckMode.OFF |
IbanValidator nationalCheck(NationalCheckMode mode) | OFF, IF_SUPPORTED or REQUIRED |
IbanValidator nationalRule(NationalCheck rule) | Replaces or adds the rule of one country, for this validator only |
IbanValidator format(IbanFormat format) | Requires an exact input format |
Optional<NationalCheck> findNationalRule(String countryCode) | The rule this validator applies |
NationalCheckMode nationalCheckMode(), Optional<IbanFormat> requiredFormat() | The configuration |
ValidationResult<Iban, IbanError> validate(CharSequence input) | Never throws; nationalCheck() reports the national status |
Iban parse(CharSequence input) | Throws InvalidIbanException |
Optional<Iban> tryParse(CharSequence input), boolean isValid(CharSequence input) | Never throw |
| Mode | Countries with a rule | Countries without a rule |
|---|---|---|
OFF | not checked (the default) | not checked |
IF_SUPPORTED | checked | valid, nationalCheck() is NOT_SUPPORTED |
REQUIRED | checked | invalid with NATIONAL_CHECK_NOT_SUPPORTED |
NationalCheckStatus is NOT_PERFORMED, PASSED, FAILED or NOT_SUPPORTED. Built-in rules exist for BA, BE, ES, FI, FR, IT, MC, ME, MK, NO, PT, RS, SI, SK, SM and TN; NationalChecks.find(String) returns one and NationalChecks.all() lists them ordered by country code. A rule that cannot judge a BBAN, for example letters where the algorithm needs digits, is treated like a missing rule.
Own rules implement NationalCheck:
| Method | Contract |
|---|---|
String id() | Stable identifier, reported by ValidationResult.rule(), e.g. FR_RIB_KEY |
String countryCode() | ISO 3166-1 alpha-2 country code, upper case |
String description() | Short English description of the algorithm |
BbanRange checkRange() | BBAN positions reported in errors |
NationalCheckOutcome check(String bban) | VALID, INVALID or NOT_APPLICABLE |
Optional<String> complete(String bban) | The BBAN with calculated national check digits, if the rule can calculate them |
boolean requiresDigits() | Whether the algorithm only works on digits |
A rule must be immutable and thread-safe, and translatable by GWT if it is used there. There is no global registration. IbanBuilder.nationalCheckDigits(true) always uses the built-in rules. See docs/national-checks.md for algorithms, sources and deliberate gaps.
BIC reference
The entry point is io.github.nalukit.pololei.Bic.
| Signature | Result / behavior |
|---|---|
static Bic parse(CharSequence input) | Throws InvalidBicException |
static Optional<Bic> tryParse(CharSequence input), static boolean isValid(CharSequence input) | Never throw, accept null |
static ValidationResult<Bic, BicError> validate(CharSequence input) | Never throws |
String institutionCode(), countryCode(), locationCode() | Characters 1-4, 5-6 and 7-8 |
Optional<String> branchCode() | Characters 9-11; empty for an 8-character BIC |
boolean isPrimaryOffice(), Bic primaryOffice() | True without branch code or with XXX; the 8-character BIC |
boolean isTestBic() | True if the location code ends with 0 |
A BIC has 8 or 11 letters or digits; characters 5-6 must be a known ISO 3166-1 country code (including XK). Following ISO 9362:2022, the first four characters may contain digits. Whether a BIC is registered with SWIFT cannot be checked offline and is not checked.
EPC QR code reference
EpcQrPayload (module pololei-epc) creates the text of an EPC QR code (EPC069-12, GiroCode) for a SEPA credit transfer. Render it with any QR code library, using error correction level M and the character set of the payload.
| Signature | Result / behavior |
|---|---|
static EpcQrPayload.Builder builder() | New, mutable builder |
String text() | The text to encode, lines separated by line feed |
List<String> lines() | The lines of the payload |
Version version(), CharacterSet characterSet() | V001/V002; UTF_8, ISO_8859_1, _2, _4, _5, _7, _10, _15 |
int byteLength() | Length in bytes in the character set; at most MAX_BYTES (331) |
| Builder method | Rule (EPC069-12) |
|---|---|
version(Version) | V002 (default) or V001 |
characterSet(CharacterSet) | UTF_8 (default) or one of the ISO 8859 sets of the guidelines |
bic(Bic) | Mandatory for version 001 and for a beneficiary outside the EEA (for example CH or GB) |
beneficiaryName(String) | Mandatory, at most 70 characters |
iban(Iban) | Mandatory, of a SEPA country |
amount(BigDecimal) | Optional, euro, 0.01 to 999999999.99, at most two decimals |
purpose(String) | Optional, 1 to 4 letters or digits |
remittanceReference(String) | Optional, structured reference, at most 35 characters |
remittanceText(String) | Optional, at most 140 characters; excludes remittanceReference |
information(String) | Optional, hint for the payer, at most 70 characters |
EpcQrPayload build() | Throws an IllegalArgumentException that names the violated field |
Texts must not contain line breaks, and the payload must not exceed 331 bytes in its character set.
SEPA Creditor Identifier reference
CreditorIdentifier (module pololei-creditor) parses and validates SEPA Creditor Identifiers (EPC262-08). It is a type of its own, not an IBAN.
| Signature | Result / behavior |
|---|---|
static CreditorIdentifier parse(CharSequence input) | Throws InvalidCreditorIdentifierException with error and position |
static Optional<CreditorIdentifier> tryParse(CharSequence input), static boolean isValid(CharSequence input) | Never throw, accept null |
static Optional<CreditorIdentifierError> validate(CharSequence input) | The error; empty if valid |
static CreditorIdentifier of(String countryCode, String businessCode, String nationalIdentifier) | Calculates the check digits; null business code means ZZZ |
static boolean isSupportedCountry(String), static boolean hasNationalFormat(String) | SEPA country; national length rule known (Germany) |
countryCode(), checkDigits(), businessCode(), nationalIdentifier() | The parts |
CreditorIdentifier withBusinessCode(String) | Same creditor with another business code |
boolean isSameCreditor(CreditorIdentifier other) | Compares without the business code |
Constants: NO_BUSINESS_CODE (ZZZ), MIN_LENGTH (8), MAX_LENGTH (35). The check digits are ISO 7064 MOD 97-10 over national identifier and country code, without the business code. A valid identifier is formally correct, not necessarily issued by a national authority.
Validation and error handling
ValidationResult<T, E> is immutable and returned by Iban.validate, IbanValidator.validate, Bban.validate and Bic.validate:
| API | Meaning |
|---|---|
isValid(), value() | Whether the input is valid; the parsed value if so |
error(), message() | Error enum and English message if invalid |
position(), lastPosition() | 1-based first and last position the error refers to, counted without whitespace |
expectedLength(), actualLength() | Lengths for length errors |
expectedType() | CharacterType expected at position() |
rule() | The national rule that failed or could not be applied |
nationalCheck() | NationalCheckStatus; also set on valid results |
| Error enum | Values |
|---|---|
IbanError | EMPTY, INVALID_FORMAT, INVALID_CHARACTER, INVALID_COUNTRY_CODE, UNSUPPORTED_COUNTRY, INVALID_LENGTH, INVALID_BBAN, INVALID_CHECK_DIGITS, INVALID_NATIONAL_CHECK_DIGITS, NATIONAL_CHECK_NOT_SUPPORTED, UNDEFINED_FIELD |
BicError | EMPTY, INVALID_LENGTH, INVALID_CHARACTER, UNKNOWN_COUNTRY |
CreditorIdentifierError | EMPTY, INVALID_CHARACTER, INVALID_LENGTH, INVALID_COUNTRY_CODE, UNSUPPORTED_COUNTRY, INVALID_CHECK_DIGITS |
IBAN errors are reported in the order of the enum: INVALID_FORMAT only with an explicit format, the national errors only with national checks, UNDEFINED_FIELD only from field validation and the builder. Messages never contain the complete input, at most a single character, the country code or the check digits, so they can be logged without leaking account numbers.
| Exception | Thrown by / meaning |
|---|---|
InvalidIbanException | Iban.parse, IbanValidator.parse, IbanBuilder.build; error() and result() give the details |
InvalidBicException | Bic.parse; error() and result() |
InvalidCreditorIdentifierException | CreditorIdentifier.parse and of; error() and position() |
IllegalArgumentException | Superclass of the three exceptions above; EpcQrPayload.Builder.build() for violated rules |
IllegalStateException | IbanBuilder with a BBAN described in more than one way |
NullPointerException | A required argument such as a format, field or rule is null; validate, isValid and tryParse accept null input |
GWT, serialization and thread safety
For GWT, use pololei-gwt instead of pololei and inherit the modules you use:
<inherits name="io.github.nalukit.pololei.Pololei"/>
<inherits name="io.github.nalukit.pololei.epc.PololeiEpc"/>
<inherits name="io.github.nalukit.pololei.creditor.PololeiCreditor"/>
Iban, Bic and ValidationResult are serializable with Java serialization and GWT-RPC. A deserialized IBAN or BIC is always validated again: Java serialization uses readResolve and throws InvalidIbanException / InvalidBicException; the GWT-RPC serializers Iban_CustomFieldSerializer, Bic_CustomFieldSerializer and ValidationResult_CustomFieldSerializer in pololei-gwt fail with a SerializationException. ValidationResult is transferred as strings and numbers, so the serialization policy needs no entries for the error enums. Put pololei-gwt next to pololei on the classpath of a GWT-RPC server.
Iban, Bic, ValidationResult, IbanValidator, EpcQrPayload, CreditorIdentifier and the country data are immutable; the static methods are stateless. IbanBuilder and EpcQrPayload.Builder are mutable and not thread-safe: create one per IBAN or payload. For random IBANs generated in parallel, pass ThreadLocalRandom.current() or one Random per thread.
Complete generated JavaDoc
Generate the full API reference from the release sources (tag 1.0.0-rc01):
git clone --depth 1 --branch 1.0.0-rc01 https://github.com/NaluKit/pololei.git \
"$POLOLEI_QUICKSTART_DIR/source"
mvn -B -ntp -f "$POLOLEI_QUICKSTART_DIR/source/pom.xml" \
org.apache.maven.plugins:maven-javadoc-plugin:3.11.2:aggregate \
-Dshow=public -Ddoclint=all,-missing -DfailOnError=true
Open $POLOLEI_QUICKSTART_DIR/source/target/reports/apidocs/index.html. This generated reference contains the public types, constructors, exact overloads, record parameters and method JavaDoc of the release, including the GWT-RPC serializers of pololei-gwt.
The command checks JavaDoc syntax, links and markup; -missing suppresses completeness warnings for individual members and enum constants. It does not claim every public member is documented. The Markdown reference remains available without generating HTML.
Troubleshooting
| Symptom | Resolution |
|---|---|
git clone cannot find 1.0.0-rc01 | Use the tag 1.0.0-rc01; it is created when the release is published. A branch name or newer snapshot is not an equivalent baseline. |
Maven cannot resolve 1.0.0-rc01 | Check network access to Maven Central and that your Maven settings (mirrors, proxies, repository managers) allow release artifacts from Central. |
| Java reports an unsupported class version or compiler release | Run both Maven and java with JDK 21 or newer; check mvn -version as well as java -version. |
NoSuchElementException in the quickstart | A result differs from the expected one. Confirm the exact version and unchanged sample values. |
| A French or Italian IBAN is valid although the bank rejects it | Iban checks the international rules only; use IbanValidator.standard().nationalCheck(...). |
IllegalStateException from IbanBuilder.build() | Describe the BBAN in one way only: bban(...), the registry parts, or field(...)s. |
| GWT compiler reports a missing source for a pololei type | Use pololei-gwt instead of pololei and inherit the GWT module of every pololei module you use. |
App cannot find example.Quickstart | Run the compile/copy step and the java command from the app directory. The classpath shown is for Linux/macOS. |