Interface Mod10Spec

All Superinterfaces:
GeneratorSpec<String>, Mod10GeneratorSpec, NullableGeneratorSpec<String>, ValueSpec<String>

public interface Mod10Spec extends Mod10GeneratorSpec, ValueSpec<String>
A spec for generating numbers that pass the Mod10 checksum algorithm.
Since:
2.16.0
  • Method Summary

    Modifier and Type
    Method
    Description
    checkDigitIndex(int checkDigitIndex)
    The index of the check digit in the input.
    endIndex(int endIndex)
    The end index for calculating the checksum.
    length(int length)
    Length of the number to generate (default value is 16).
    multiplier(int multiplier)
    Multiplier to be used for odd digits when calculating the Mod10 checksum (default value is 3).
    Indicates that null value can be generated.
    startIndex(int startIndex)
    The start index for calculating the checksum (default value is 0).
    weight(int weight)
    The weight to be used for even digits when calculating the Mod10 checksum (default value is 1).

    Methods inherited from interface org.instancio.generator.ValueSpec

    get, list, map, stream, toModel
  • Method Details

    • multiplier

      Mod10Spec multiplier(int multiplier)
      Description copied from interface: Mod10GeneratorSpec
      Multiplier to be used for odd digits when calculating the Mod10 checksum (default value is 3).
      Specified by:
      multiplier in interface Mod10GeneratorSpec
      Parameters:
      multiplier - for odd digits
      Returns:
      spec builder
    • weight

      Mod10Spec weight(int weight)
      Description copied from interface: Mod10GeneratorSpec
      The weight to be used for even digits when calculating the Mod10 checksum (default value is 1).
      Specified by:
      weight in interface Mod10GeneratorSpec
      Parameters:
      weight - for even digits
      Returns:
      spec builder
    • startIndex

      Mod10Spec startIndex(int startIndex)
      Description copied from interface: Mod10GeneratorSpec
      The start index for calculating the checksum (default value is 0).
      Specified by:
      startIndex in interface Mod10GeneratorSpec
      Parameters:
      startIndex - for calculating the checksum (inclusive)
      Returns:
      spec builder
    • endIndex

      Mod10Spec endIndex(int endIndex)
      Description copied from interface: Mod10GeneratorSpec
      The end index for calculating the checksum.
      Specified by:
      endIndex in interface Mod10GeneratorSpec
      Parameters:
      endIndex - for calculating the checksum (inclusive)
      Returns:
      spec builder
    • length

      Mod10Spec length(int length)
      Description copied from interface: Mod10GeneratorSpec
      Length of the number to generate (default value is 16).
      Specified by:
      length in interface Mod10GeneratorSpec
      Parameters:
      length - of the number to generate
      Returns:
      spec builder
    • checkDigitIndex

      Mod10Spec checkDigitIndex(int checkDigitIndex)
      Description copied from interface: Mod10GeneratorSpec
      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).

      Specified by:
      checkDigitIndex in interface Mod10GeneratorSpec
      Parameters:
      checkDigitIndex - index of the check digit
      Returns:
      spec builder
    • nullable

      Mod10Spec nullable()
      Description copied from interface: Mod10GeneratorSpec
      Indicates that null value can be generated.
      Specified by:
      nullable in interface Mod10GeneratorSpec
      Specified by:
      nullable in interface NullableGeneratorSpec<String>
      Specified by:
      nullable in interface ValueSpec<String>
      Returns:
      spec builder