Interface Mod11GeneratorSpec

All Superinterfaces:
GeneratorSpec<String>, NullableGeneratorSpec<String>
All Known Subinterfaces:
Mod11AsGeneratorSpec, Mod11Spec

public interface Mod11GeneratorSpec extends NullableGeneratorSpec<String>
A spec for generating numbers that pass the Mod11 checksum algorithm.

The methods provided by this interface (as well as their Javadocs) were copied from the org.hibernate.validator.constraints.Mod11Check annotation attributes.

Since:
2.16.0
  • Method Details

    • length

      Mod11GeneratorSpec length(int length)
      Length of the number to generate (default value is 16).
      Parameters:
      length - of the number to generate
      Returns:
      spec builder
      Since:
      2.16.0
    • threshold

      Mod11GeneratorSpec threshold(int threshold)
      The threshold for the Mod11 algorithm multiplier growth, if no value is specified the multiplier will grow indefinitely (default value is Integer.MAX_VALUE).
      Parameters:
      threshold - for the multiplier growth
      Returns:
      spec builder
      Since:
      2.16.0
    • startIndex

      Mod11GeneratorSpec startIndex(int startIndex)
      The start index for calculating the checksum (default value is 0).
      Parameters:
      startIndex - for calculating the checksum (inclusive)
      Returns:
      spec builder
      Since:
      2.16.0
    • endIndex

      Mod11GeneratorSpec endIndex(int endIndex)
      The end index for calculating the checksum.
      Parameters:
      endIndex - for calculating the checksum (inclusive)
      Returns:
      spec builder
      Since:
      2.16.0
    • checkDigitIndex

      Mod11GeneratorSpec checkDigitIndex(int checkDigitIndex)
      The index of the check digit in the input. If not specified, the last digit will be used as the check digit.

      If set, the digit at the specified index is used. If set the following must hold true:
      checkDigitIndex >= 0 && (checkDigitIndex < startIndex || checkDigitIndex >= endIndex).

      Parameters:
      checkDigitIndex - index of the check digit
      Returns:
      spec builder
      Since:
      2.16.0
    • treatCheck10As

      Mod11GeneratorSpec treatCheck10As(char treatCheck10As)
      The char that represents the check digit when the Mod11 checksum equals 10 (default value is 'X').
      Parameters:
      treatCheck10As - check digit character to use when the checksum is 10
      Returns:
      spec builder
      Since:
      2.16.0
    • treatCheck11As

      Mod11GeneratorSpec treatCheck11As(char treatCheck11As)
      The char that represents the check digit when the Mod11 checksum equals 11 (default value is '0').
      Parameters:
      treatCheck11As - check digit character to use when the checksum is 11
      Returns:
      spec builder
      Since:
      2.16.0
    • leftToRight

      Mod11GeneratorSpec leftToRight()
      Specifies that the Mod11 checksum must be done from the leftmost to the rightmost digit (default behaviour is right to left).

      e.g. Code 12345-?:

      • Right to left: the sum (5*2 + 4*3 + 3*4 + 2*5 + 1*6) with check digit 5
      • Left to right: the sum (1*2 + 2*3 + 3*4 + 4*5 + 5*6) with check digit 7
      Returns:
      spec builder
      Since:
      2.16.0
    • nullable

      Mod11GeneratorSpec nullable()
      Indicates that null value can be generated.
      Specified by:
      nullable in interface NullableGeneratorSpec<String>
      Returns:
      spec builder
      Since:
      2.16.0