public class IBANValidator extends Object
Modifier and Type | Class and Description |
---|---|
static class |
IBANValidator.Validator |
Modifier and Type | Field and Description |
---|---|
static IBANValidator |
DEFAULT_IBAN_VALIDATOR |
Constructor and Description |
---|
IBANValidator()
Create a default IBAN validator.
|
IBANValidator(IBANValidator.Validator[] formatMap)
Create an IBAN validator from the specified map of IBAN formats.
|
Modifier and Type | Method and Description |
---|---|
IBANValidator.Validator[] |
getDefaultValidators()
Gets a copy of the default Validators.
|
static IBANValidator |
getInstance()
Return a singleton instance of the IBAN validator using the default formats
|
IBANValidator.Validator |
getValidator(String code)
Get the Validator for a given IBAN
|
boolean |
hasValidator(String code)
Does the class have the required validator?
|
boolean |
isValid(String code)
Validate an IBAN Code.
|
IBANValidator.Validator |
setValidator(IBANValidator.Validator validator)
Installs a validator.
|
IBANValidator.Validator |
setValidator(String countryCode,
int length,
String format)
Installs a validator.
|
public static final IBANValidator DEFAULT_IBAN_VALIDATOR
public IBANValidator()
public IBANValidator(IBANValidator.Validator[] formatMap)
formatMap
- map of IBAN formatspublic static IBANValidator getInstance()
public boolean isValid(String code)
Validate an IBAN Code.
value
- The value validation is being performed ontrue
if the value is validpublic boolean hasValidator(String code)
code
- the code to checkpublic IBANValidator.Validator[] getDefaultValidators()
public IBANValidator.Validator getValidator(String code)
code
- a string starting with the ISO country code (e.g. an IBAN)null
if there is not one registered.public IBANValidator.Validator setValidator(IBANValidator.Validator validator)
validator
- the instance to install.null
if there was noneIllegalStateException
- if an attempt is made to modify the singleton validatorpublic IBANValidator.Validator setValidator(String countryCode, int length, String format)
countryCode
- length
- the length of the IBAN. Must be ≥ 8 and ≤ 32.
If the length is < 0, the validator is removed, and the format is not used.format
- the format of the IBAN (as a regular expression)null
if there was noneIllegalArgumentException
- if there is a problemIllegalStateException
- if an attempt is made to modify the singleton validatorCopyright © 2002–2017 The Apache Software Foundation. All rights reserved.