org.hibernate.validator.constraints

## Annotation Type Mod10Check

-     @Documented
      @Constraint(validatedBy={})
      @Target(value={METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER})
      @Retention(value=RUNTIME)
      public @interface Mod10Check

  @Modulo 10 check constraint.

  Allows to validate that a series of digits pass the Mod10 checksum algorithm. The classic Mod10 is calculated by summing up the digits, with every odd digit (from right to left) value multiplied by a `multiplier`. As example ISBN-13 is Modulo 10 checksum with `multiplier = 3`.

  There are known cases of codes using multipliers for both even and odd digits; To support this kind of implementations the Mod10 constraint uses the `weight` option, which has the same effect as the multiplier but for even numbers.

  The supported type is `CharSequence`. `null` is considered valid.

  Author:
    George Gastaldi, Hardy Ferentschik, Victor Rezende dos Santos

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `int` | `checkDigitIndex`
    `int` | `endIndex`
    `Class<?>[]` | `groups`
    `boolean` | `ignoreNonDigitCharacters`
    `String` | `message`
    `int` | `multiplier`
    `Class<? extends Payload>[]` | `payload`
    `int` | `startIndex`
    `int` | `weight`

- - ### Element Detail

    - #### message

          public abstract String message

      Default:
        "{org.hibernate.validator.constraints.Mod10Check.message}"

    - #### groups

          public abstract Class<?>[] groups

      Default:
        {}

    - #### payload

          public abstract Class<? extends Payload>[] payload

      Default:
        {}

    - #### multiplier

          public abstract int multiplier

      Returns:
        The multiplier to be used for odd digits when calculating the Mod10 checksum.
      Default:
        3

    - #### weight

          public abstract int weight

      Returns:
        The weight to be used for even digits when calculating the Mod10 checksum.
      Default:
        1

    - #### startIndex

          public abstract int startIndex

      Returns:
        the start index (inclusive) for calculating the checksum. If not specified 0 is assumed.
      Default:
        0

    - #### endIndex

          public abstract int endIndex

      Returns:
        the end index (inclusive) for calculating the checksum. If not specified the whole value is considered.
      Default:
        2147483647

    - #### checkDigitIndex

          public abstract int checkDigitIndex

      Returns:
        The index of the check digit in the input. Per default it is assumed that the check digit is the last digit of the specified range. If set, the digit at the specified index is used. If set the following must hold true:
        `checkDigitIndex > 0 && (checkDigitIndex < startIndex || checkDigitIndex >= endIndex`.
      Default:
        -1

    - #### ignoreNonDigitCharacters

          public abstract boolean ignoreNonDigitCharacters

      Returns:
        Whether non-digit characters in the validated input should be ignored (`true`) or result in a validation error (`false`).
      Default:
        true

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