Class LuhnGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<String>
org.instancio.internal.generator.text.LuhnGenerator
- All Implemented Interfaces:
Generator<String>,GeneratorSpec<String>,NullableGeneratorSpec<String>,InternalLengthGeneratorSpec<String>
public class LuhnGenerator
extends AbstractGenerator<String>
implements NullableGeneratorSpec<String>, InternalLengthGeneratorSpec<String>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.checkIndex(int idx) endIndex(int idx) length(int length) length(int min, int max) nullable()Indicates thatnullvalue can be generated.nullable(boolean isNullable) startIndex(int idx) protected StringtryGenerateNonNull(Random random) Makes the best effort to return a non-null value.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
generate, getContext, hints, isNullable
-
Constructor Details
-
LuhnGenerator
-
-
Method Details
-
apiMethod
Description copied from class:AbstractGeneratorReturns the public API method name of the generator spec. The returned name is used for reporting validation errors.- Specified by:
apiMethodin classAbstractGenerator<String>- Returns:
- spec name if defined, or
nullotherwise
-
nullable
Description copied from interface:NullableGeneratorSpecIndicates thatnullvalue can be generated.- Specified by:
nullablein interfaceNullableGeneratorSpec<String>- Overrides:
nullablein classAbstractGenerator<String>- Returns:
- spec builder
-
nullable
- Overrides:
nullablein classAbstractGenerator<String>
-
startIndex
-
endIndex
-
checkIndex
-
length
-
length
- Specified by:
lengthin interfaceInternalLengthGeneratorSpec<String>
-
tryGenerateNonNull
Description copied from class:AbstractGeneratorMakes the best effort to return a non-null value. However, in certain cases this method will produce anull.- Specified by:
tryGenerateNonNullin classAbstractGenerator<String>- Parameters:
random- for generating the value- Returns:
- generated value, either a null or non-null
-