public class Mod11CheckValidator extends ModCheckBase implements ConstraintValidator<Mod11Check,CharSequence>
Constructor and Description |
---|
Mod11CheckValidator() |
Modifier and Type | Method and Description |
---|---|
void |
initialize(int startIndex,
int endIndex,
int checkDigitIndex,
boolean ignoreNonDigitCharacters,
int threshold,
char treatCheck10As,
char treatCheck11As,
Mod11Check.ProcessingDirection direction) |
void |
initialize(Mod11Check constraintAnnotation)
Initializes the validator in preparation for
ConstraintValidator.isValid(Object, ConstraintValidatorContext) calls. |
boolean |
isCheckDigitValid(List<Integer> digits,
char checkDigit)
Validate check digit using Mod11 checksum
|
extractDigit, initialize, isValid
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isValid
public void initialize(Mod11Check constraintAnnotation)
ConstraintValidator
ConstraintValidator.isValid(Object, ConstraintValidatorContext)
calls.
The constraint annotation for a given constraint declaration
is passed.
This method is guaranteed to be called before any use of this instance for
validation.initialize
in interface ConstraintValidator<Mod11Check,CharSequence>
constraintAnnotation
- annotation instance for a given constraint declarationpublic void initialize(int startIndex, int endIndex, int checkDigitIndex, boolean ignoreNonDigitCharacters, int threshold, char treatCheck10As, char treatCheck11As, Mod11Check.ProcessingDirection direction)
public boolean isCheckDigitValid(List<Integer> digits, char checkDigit)
isCheckDigitValid
in class ModCheckBase
digits
- The digits over which to calculate the checksumcheckDigit
- the check digittrue
if the mod11 result matches the check digit, false
otherwiseCopyright © 2017 JBoss by Red Hat. All rights reserved.