Interface LuhnGeneratorSpec

All Superinterfaces:
GeneratorSpec<String>, NullableGeneratorSpec<String>
All Known Subinterfaces:
LuhnAsGeneratorSpec, LuhnSpec

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

The following methods:

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

Since:
3.1.0
  • Method Details

    • length

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

      LuhnGeneratorSpec length(int min, int max)
      Generate a number of random length within the specified range.
      Parameters:
      min - minimum length (inclusive)
      max - maximum length (inclusive)
      Returns:
      spec builder
      Since:
      3.1.0
    • startIndex

      LuhnGeneratorSpec 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:
      3.1.0
    • endIndex

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

      LuhnGeneratorSpec 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:
      3.1.0
    • nullable

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