Class Modulus511CheckDigit
java.lang.Object
org.apache.commons.validator.routines.checkdigit.ModulusCheckDigit
org.apache.commons.validator.routines.checkdigit.Modulus31CheckDigit
org.apache.commons.validator.routines.checkdigit.Modulus511CheckDigit
- All Implemented Interfaces:
Serializable,CheckDigit,IsoIecConstants
Implements MOD 511 check digit simple procedure.
MOD 511 applies to numeric strings, the check digit is numeric and has the length of 3 digits. It is used for French Numéro d'immatriculation fiscale (NIF). See Wikipedia - NIF (fr) for more details.
- Since:
- 2.10.6
- Author:
- EUG https://github.com/homebeaver
- See Also:
-
Field Summary
Fields inherited from interface org.apache.commons.validator.routines.checkdigit.IsoIecConstants
ALPHABETIC, ALPHABETIC23, ALPHANUMERIC, ALPHANUMERIC_PLUS_STAR, ALPHANUMERIC31, MODULUS_1271, MODULUS_23, MODULUS_31, MODULUS_37, MODULUS_511, MODULUS_661, MODULUS_89, MODULUS_97, NUMERIC, NUMERIC_PLUS_X, RADIX_10, RADIX_100, RADIX_2, RADIX_26, RADIX_36 -
Method Summary
Modifier and TypeMethodDescriptionprotected intstatic CheckDigitGets the singleton instance of this validator.protected StringtoCheckDigit(int charValue) Convert an integer value to a check digit.Methods inherited from class org.apache.commons.validator.routines.checkdigit.Modulus31CheckDigit
calculateModulus, isValid, weightedValueMethods inherited from class org.apache.commons.validator.routines.checkdigit.ModulusCheckDigit
calculate, getModulus, sumDigits, toInt
-
Method Details
-
getInstance
Gets the singleton instance of this validator.- Returns:
- A singleton instance of the class.
-
getCheckdigitLength
protected int getCheckdigitLength()- Overrides:
getCheckdigitLengthin classModulusCheckDigit
-
toCheckDigit
Convert an integer value to a check digit.Note: this implementation only handles single-digit numeric values For non-numeric characters, override this method to provide integer-->character conversion.
Override to map charValue to alphanumerics.
Override to handle charValues with three digits.
- Overrides:
toCheckDigitin classModulus31CheckDigit- Parameters:
charValue- The integer value of the character- Returns:
- The converted character
- Throws:
CheckDigitException- if integer character value doesn't represent a numeric character
-