Class REGONValidator
- java.lang.Object
-
- org.hibernate.validator.internal.constraintvalidators.hv.ModCheckBase
-
- org.hibernate.validator.internal.constraintvalidators.hv.pl.PolishNumberValidator<REGON>
-
- org.hibernate.validator.internal.constraintvalidators.hv.pl.REGONValidator
-
- All Implemented Interfaces:
ConstraintValidator<REGON,CharSequence>
public class REGONValidator extends PolishNumberValidator<REGON>
Validator forREGON. Validates both 9 and 14 digits REGON numbers.- Author:
- Marko Bekhta
-
-
Constructor Summary
Constructors Constructor Description REGONValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int[]getWeights(List<Integer> digits)voidinitialize(REGON constraintAnnotation)Initializes the validator in preparation forConstraintValidator.isValid(Object, ConstraintValidatorContext)calls.-
Methods inherited from class org.hibernate.validator.internal.constraintvalidators.hv.pl.PolishNumberValidator
isCheckDigitValid
-
Methods inherited from class org.hibernate.validator.internal.constraintvalidators.hv.ModCheckBase
extractDigit, initialize, isValid
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.validation.ConstraintValidator
isValid
-
-
-
-
Method Detail
-
initialize
public void initialize(REGON constraintAnnotation)
Description copied from interface:ConstraintValidatorInitializes the validator in preparation forConstraintValidator.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- annotation instance for a given constraint declaration
-
getWeights
protected int[] getWeights(List<Integer> digits)
- Specified by:
getWeightsin classPolishNumberValidator<REGON>- Parameters:
digits- a list of digits to be verified. They are used to determine a size of REGON number - is it 9 or 14 digit number- Returns:
- an array of weights to be used to calculate a checksum
-
-