Schnittstelle CheckDigit
- Alle bekannten Implementierungsklassen:
IBANCheckDigit
public interface CheckDigit
Check Digit calculation and validation.
The logic for validating check digits has previously been
embedded within the logic for specific code validation, which
includes other validations such as verifying the format
or length of a code. CheckDigit
provides for separating out
the check digit calculation logic enabling it to be more easily
tested and reused.
Although Commons Validator is primarily concerned with validation,
CheckDigit
also defines behaviour for calculating/generating check
digits, since it makes sense that users will want to (re-)use the
same logic for both.s
- Seit:
- Validator 1.4
- Version:
- $Revision: 1649287 $
-
Methodenübersicht
-
Methodendetails
-
calculate
Calculates the Check Digit for a code.- Parameter:
code
- The code to calculate the Check Digit for. The string must not include the check digit- Gibt zurück:
- The calculated Check Digit
- Löst aus:
CheckDigitException
- if an error occurs.
-
isValid
Validates the check digit for the code.- Parameter:
code
- The code to validate, the string must include the check digit.- Gibt zurück:
true
if the check digit is valid, otherwisefalse
.- Löst aus:
CheckDigitException
- unspecific error
-