Package org.instancio.generator.specs
Interface Mod10GeneratorSpec
- All Superinterfaces:
GeneratorSpec<String>
,NullableGeneratorSpec<String>
- All Known Subinterfaces:
Mod10AsGeneratorSpec
,Mod10Spec
A spec for generating numbers that pass the Mod10 checksum algorithm.
The methods provided by this interface (as well as their Javadocs)
were copied from the org.hibernate.validator.constraints.Mod10Check
annotation attributes.
- Since:
- 2.16.0
-
Method Summary
Modifier and TypeMethodDescriptioncheckDigitIndex
(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 is16
).multiplier
(int multiplier) Multiplier to be used for odd digits when calculating the Mod10 checksum (default value is3
).nullable()
Indicates thatnull
value can be generated.startIndex
(int startIndex) The start index for calculating the checksum (default value is0
).weight
(int weight) The weight to be used for even digits when calculating the Mod10 checksum (default value is1
).
-
Method Details
-
length
Length of the number to generate (default value is16
).- Parameters:
length
- of the number to generate- Returns:
- spec builder
- Since:
- 2.16.0
-
multiplier
Multiplier to be used for odd digits when calculating the Mod10 checksum (default value is3
).- Parameters:
multiplier
- for odd digits- Returns:
- spec builder
- Since:
- 2.16.0
-
weight
The weight to be used for even digits when calculating the Mod10 checksum (default value is1
).- Parameters:
weight
- for even digits- Returns:
- spec builder
- Since:
- 2.16.0
-
startIndex
The start index for calculating the checksum (default value is0
).- Parameters:
startIndex
- for calculating the checksum (inclusive)- Returns:
- spec builder
- Since:
- 2.16.0
-
endIndex
The end index for calculating the checksum.- Parameters:
endIndex
- for calculating the checksum (inclusive)- Returns:
- spec builder
- Since:
- 2.16.0
-
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
-
nullable
Mod10GeneratorSpec nullable()Indicates thatnull
value can be generated.- Specified by:
nullable
in interfaceNullableGeneratorSpec<String>
- Returns:
- spec builder
- Since:
- 2.16.0
-