Class Modulus11DKCheckDigit
java.lang.Object
org.apache.commons.validator.routines.checkdigit.ModulusCheckDigit
org.apache.commons.validator.routines.checkdigit.Modulus11iWeightCheckDigit
org.apache.commons.validator.routines.checkdigit.Modulus11iBSNCheckDigit
org.apache.commons.validator.routines.checkdigit.Modulus11DKCheckDigit
- All Implemented Interfaces:
Serializable,CheckDigit
Danish Tax identification number (TIN) and VATIN Check Digit calculation/validation.
det Centrale PersonRegister - nummer (CPR-nummer)
Nmomsregistreringsnummer (SE-nr.)
See Wikipedia - CPR-numme (da) and Wikipedia - VAT IN (en) for more details.
- Since:
- 2.10.6
- Author:
- EUG https://github.com/homebeaver
- See Also:
-
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.protected intweightedValue(int charValue, int leftPos, int rightPos) Calculates the weighted value of a character in the code at a specified position.Methods inherited from class org.apache.commons.validator.routines.checkdigit.Modulus11iBSNCheckDigit
calculateMethods inherited from class org.apache.commons.validator.routines.checkdigit.Modulus11iWeightCheckDigit
isValidMethods inherited from class org.apache.commons.validator.routines.checkdigit.ModulusCheckDigit
calculateModulus, getModulus, sumDigits, toInt
-
Method Details
-
getInstance
Gets the singleton instance of this validator.- Returns:
- A singleton instance of the class.
-
getCheckdigitLength
protected int getCheckdigitLength()Override because there is no checkdigit.
- Overrides:
getCheckdigitLengthin classModulusCheckDigit
-
weightedValue
Calculates the weighted value of a character in the code at a specified position.TIN, VATID digits are weighted by their position from right to left. There is no check digit at the right most pos where the weight is 1. The next weight is 2, 3, .. to 7, Then we repeat the weight 2, 3, ...
- Overrides:
weightedValuein classModulus11iWeightCheckDigit- Parameters:
charValue- The numeric value of the character.leftPos- The position of the character in the code, counting from left to rightrightPos- The positionof the character in the code, counting from right to left- Returns:
- The weighted value of the character.
- Throws:
CheckDigitException- if an error occurs calculating the weighted value
-
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 handle charValue 10.
Override because charValue 0 is the only valid check digit value and there is no checkdigit.
- Overrides:
toCheckDigitin classModulus11iWeightCheckDigit- Parameters:
charValue- The integer value of the character- Returns:
- The converted character
- Throws:
CheckDigitException- if integer character value doesn't represent a numeric character
-