Class ModCheckBase
- java.lang.Object
-
- org.hibernate.validator.internal.constraintvalidators.hv.ModCheckBase
-
- Direct Known Subclasses:
LuhnCheckValidator,Mod10CheckValidator,Mod11CheckValidator,ModCheckValidator,PESELValidator,PolishNumberValidator
public abstract class ModCheckBase extends Object
ModCheckBase contains all shared methods and options used by Mod Check Validators http://en.wikipedia.org/wiki/Check_digit- Author:
- George Gastaldi, Hardy Ferentschik, Victor Rezende dos Santos
-
-
Constructor Summary
Constructors Constructor Description ModCheckBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intextractDigit(char value)Returns the numericintvalue of acharprotected voidinitialize(int startIndex, int endIndex, int checkDigitIndex, boolean ignoreNonDigitCharacters)abstract booleanisCheckDigitValid(List<Integer> digits, char checkDigit)booleanisValid(CharSequence value, ConstraintValidatorContext context)
-
-
-
Method Detail
-
isValid
public boolean isValid(CharSequence value, ConstraintValidatorContext context)
-
initialize
protected void initialize(int startIndex, int endIndex, int checkDigitIndex, boolean ignoreNonDigitCharacters)
-
extractDigit
protected int extractDigit(char value) throws NumberFormatExceptionReturns the numericintvalue of achar- Parameters:
value- the inputcharto be parsed- Returns:
- the numeric
intvalue represented by the character. - Throws:
NumberFormatException- in case character is not a digit
-
-