org.hibernate.validator.internal.constraintvalidators

## Class ModCheckBase

- java.lang.Object
- - org.hibernate.validator.internal.constraintvalidators.ModCheckBase

- Direct Known Subclasses:
    LuhnCheckValidator, Mod10CheckValidator, Mod11CheckValidator, ModCheckValidator

      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 and Description
    `ModCheckBase()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `extractDigit(char value)` Returns the numeric `int` value of a `char`
    `protected void` | `initialize(int startIndex, int endIndex, int checkDigitIndex, boolean ignoreNonDigitCharacters)`
    `abstract boolean` | `isCheckDigitValid(List<Integer> digits, char checkDigit)`
    `boolean` | `isValid(CharSequence value, ConstraintValidatorContext context)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ModCheckBase

          public ModCheckBase()

  - ### Method Detail

    - #### isValid

          public boolean isValid(CharSequence value,
                        ConstraintValidatorContext context)

    - #### isCheckDigitValid

          public abstract boolean isCheckDigitValid(List<Integer> digits,
                                  char checkDigit)

    - #### initialize

          protected void initialize(int startIndex,
                        int endIndex,
                        int checkDigitIndex,
                        boolean ignoreNonDigitCharacters)

    - #### extractDigit

          protected int extractDigit(char value)
                              throws NumberFormatException

      Returns the numeric `int` value of a `char`
      Parameters:
        `value` - the input `char` to be parsed
      Returns:
        the numeric `int` value represented by the character.
      Throws:
        `NumberFormatException` - in case character is not a digit

Copyright © 2007-2014 Red Hat, Inc. All Rights Reserved