Top Description Fields Constructors Methods
org.hibernate.validator.internal.constraintvalidators.hv

public Class ModCheckValidator

extends ModCheckBase
implements ConstraintValidator<ModCheck, CharSequence>
Class Inheritance
All Implemented Interfaces
jakarta.validation.ConstraintValidator
Annotations
@Deprecated
Imports
java.util.List, jakarta.validation.ConstraintValidator, org.hibernate.validator.constraints.ModCheck, .ModCheck.ModType, org.hibernate.validator.internal.util.ModUtil

Deprecated

As of release 5.1.0, replaced by Mod10CheckValidator and Mod11CheckValidator

Mod check validator for MOD10 and MOD11 algorithms http://en.wikipedia.org/wiki/Luhn_algorithm http://en.wikipedia.org/wiki/Check_digit
Authors
George Gastaldi, Hardy Ferentschik

Field Summary

Modifier and TypeField and Description
private ModCheck.ModType
modType

The type of checksum algorithm

private int
multiplier

Multiplier used by the mod algorithms

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
initialize(ModCheck
annotation instance for a given constraint declaration
constraintAnnotation
)

Overrides default jakarta.validation.ConstraintValidator.initialize.

Deprecated as a consequence of ModCheck being deprecated.
Initializes the validator in preparation for isValid(Object, ConstraintValidatorContext) calls.
public boolean

Returns:

true if the mod 10/11 result matches the check digit, false otherwise
isCheckDigitValid
(List<Integer>
the digits over which to calculate the Mod10 or Mod11 checksum
digits
,
char
the check digit
checkDigit
)

Implements abstract org.hibernate.validator.internal.constraintvalidators.hv.ModCheckBase.isCheckDigitValid.

Check if the input passes the Mod10 (Luhn algorithm implementation only) or Mod11 test
Inherited from org.hibernate.validator.internal.constraintvalidators.hv.ModCheckBase:
extractDigitinitializeisValid

Field Detail

modTypeback to summary
private ModCheck.ModType modType

The type of checksum algorithm

multiplierback to summary
private int multiplier

Multiplier used by the mod algorithms

Constructor Detail

ModCheckValidatorback to summary
public ModCheckValidator()

Method Detail

initializeback to summary
public void initialize(ModCheck constraintAnnotation)

Overrides default jakarta.validation.ConstraintValidator.initialize.

Doc from jakarta.validation.ConstraintValidator.initialize.

Deprecated

as a consequence of ModCheck being deprecated. See corresponding docs for further information.

Initializes the validator in preparation for 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.

The default implementation is a no-op.

Parameters
constraintAnnotation:ModCheck

annotation instance for a given constraint declaration

Annotations
@Override
isCheckDigitValidback to summary
public boolean isCheckDigitValid(List<Integer> digits, char checkDigit)

Implements abstract org.hibernate.validator.internal.constraintvalidators.hv.ModCheckBase.isCheckDigitValid.

Check if the input passes the Mod10 (Luhn algorithm implementation only) or Mod11 test

Parameters
digits:List<Integer>

the digits over which to calculate the Mod10 or Mod11 checksum

checkDigit:char

the check digit

Returns:boolean

true if the mod 10/11 result matches the check digit, false otherwise

Annotations
@Override