Class REGONValidator

    • Constructor Detail

      • REGONValidator

        public REGONValidator()
    • Method Detail

      • initialize

        public void initialize​(REGON constraintAnnotation)
        Description copied from interface: ConstraintValidator
        Initializes the validator in preparation for 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.

        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:
        getWeights in class PolishNumberValidator<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