Package org.instancio.generator.specs
Interface Mod10Spec
- All Superinterfaces:
AsGeneratorSpec<String>,GeneratorSpec<String>,Mod10GeneratorSpec,NullableGeneratorSpec<String>,Supplier<String>,ValueSpec<String>
A spec for generating numbers that pass the Mod10 checksum algorithm.
- 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 thatnullvalue 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).Methods inherited from interface org.instancio.generator.specs.AsGeneratorSpec
as, asString
-
Method Details
-
multiplier
Description copied from interface:Mod10GeneratorSpecMultiplier to be used for odd digits when calculating the Mod10 checksum (default value is3).- Specified by:
multiplierin interfaceMod10GeneratorSpec- Parameters:
multiplier- for odd digits- Returns:
- spec builder
-
weight
Description copied from interface:Mod10GeneratorSpecThe weight to be used for even digits when calculating the Mod10 checksum (default value is1).- Specified by:
weightin interfaceMod10GeneratorSpec- Parameters:
weight- for even digits- Returns:
- spec builder
-
startIndex
Description copied from interface:Mod10GeneratorSpecThe start index for calculating the checksum (default value is0).- Specified by:
startIndexin interfaceMod10GeneratorSpec- Parameters:
startIndex- for calculating the checksum (inclusive)- Returns:
- spec builder
-
endIndex
Description copied from interface:Mod10GeneratorSpecThe end index for calculating the checksum.- Specified by:
endIndexin interfaceMod10GeneratorSpec- Parameters:
endIndex- for calculating the checksum (inclusive)- Returns:
- spec builder
-
length
Description copied from interface:Mod10GeneratorSpecLength of the number to generate (default value is16).- Specified by:
lengthin interfaceMod10GeneratorSpec- Parameters:
length- of the number to generate- Returns:
- spec builder
-
checkDigitIndex
Description copied from interface:Mod10GeneratorSpecThe 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:
checkDigitIndexin interfaceMod10GeneratorSpec- Parameters:
checkDigitIndex- index of the check digit- Returns:
- spec builder
-
nullable
Mod10Spec nullable()Description copied from interface:Mod10GeneratorSpecIndicates thatnullvalue can be generated.- Specified by:
nullablein interfaceMod10GeneratorSpec- Specified by:
nullablein interfaceNullableGeneratorSpec<String>- Specified by:
nullablein interfaceValueSpec<String>- Returns:
- spec builder
-