Class CreditCardNumberGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<String>
org.instancio.internal.generator.domain.finance.CreditCardNumberGenerator
- All Implemented Interfaces:
Generator<String>,GeneratorSpec<String>,CreditCardGeneratorSpec,CreditCardSpec,NullableGeneratorSpec<String>,ValueSpec<String>
-
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.Specifies that MasterCard credit card numbers should be generated.nullable()Indicates thatnullvalue can be generated.protected StringtryGenerateNonNull(Random random) Makes the best effort to return a non-null value.visa()Specifies that Visa credit card numbers should be generated.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
generate, getContext, hints, isNullable, nullable
-
Constructor Details
-
CreditCardNumberGenerator
public CreditCardNumberGenerator() -
CreditCardNumberGenerator
-
-
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
-
visa
Description copied from interface:CreditCardGeneratorSpecSpecifies that Visa credit card numbers should be generated.- Specified by:
visain interfaceCreditCardGeneratorSpec- Specified by:
visain interfaceCreditCardSpec- Returns:
- spec builder
-
masterCard
Description copied from interface:CreditCardGeneratorSpecSpecifies that MasterCard credit card numbers should be generated.- Specified by:
masterCardin interfaceCreditCardGeneratorSpec- Specified by:
masterCardin interfaceCreditCardSpec- Returns:
- spec builder
-
nullable
Description copied from interface:NullableGeneratorSpecIndicates thatnullvalue can be generated.- Specified by:
nullablein interfaceCreditCardGeneratorSpec- Specified by:
nullablein interfaceCreditCardSpec- Specified by:
nullablein interfaceNullableGeneratorSpec<String>- Specified by:
nullablein interfaceValueSpec<String>- Overrides:
nullablein classAbstractGenerator<String>- Returns:
- spec builder
-
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
-