Class StringGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<String>
org.instancio.internal.generator.lang.StringGenerator
- All Implemented Interfaces:
Generator<String>
,GeneratorSpec<String>
,StringGeneratorSpec
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionIndicates that an empty string can be generated.Generates a mixed case alphanumeric string.digits()
Generates a string comprised of only digits.Returns a generated value.length
(int length) Length of string to generate.length
(int minLength, int maxLength) Length of string to generate.Generates a lower case string.maxLength
(int length) Maximum length of string to generate.minLength
(int length) Minimum length of string to generate.Generates a mixed case string.nullable()
Indicates thatnull
value can be generated.Specifies a String prefix.Generates an upper case string.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
getContext, hints
-
Field Details
-
minLength
protected int minLength -
maxLength
protected int maxLength
-
-
Constructor Details
-
StringGenerator
-
-
Method Details
-
prefix
Description copied from interface:StringGeneratorSpec
Specifies a String prefix.- Specified by:
prefix
in interfaceStringGeneratorSpec
- Parameters:
prefix
- for generated strings- Returns:
- spec builder
-
allowEmpty
Description copied from interface:StringGeneratorSpec
Indicates that an empty string can be generated.- Specified by:
allowEmpty
in interfaceStringGeneratorSpec
- Returns:
- spec builder
-
nullable
Description copied from interface:StringGeneratorSpec
Indicates thatnull
value can be generated.- Specified by:
nullable
in interfaceStringGeneratorSpec
- Returns:
- spec builder
-
length
Description copied from interface:StringGeneratorSpec
Length of string to generate.- Specified by:
length
in interfaceStringGeneratorSpec
- Parameters:
length
- exact length to generate- Returns:
- spec builder
-
length
Description copied from interface:StringGeneratorSpec
Length of string to generate.- Specified by:
length
in interfaceStringGeneratorSpec
- Parameters:
minLength
- minimum length (inclusive)maxLength
- maximum length (inclusive)- Returns:
- spec builder
-
minLength
Description copied from interface:StringGeneratorSpec
Minimum length of string to generate.- Specified by:
minLength
in interfaceStringGeneratorSpec
- Parameters:
length
- minimum length (inclusive)- Returns:
- spec builder
-
maxLength
Description copied from interface:StringGeneratorSpec
Maximum length of string to generate.- Specified by:
maxLength
in interfaceStringGeneratorSpec
- Parameters:
length
- maximum length (inclusive)- Returns:
- spec builder
-
lowerCase
Description copied from interface:StringGeneratorSpec
Generates a lower case string.- Specified by:
lowerCase
in interfaceStringGeneratorSpec
- Returns:
- spec builder
-
upperCase
Description copied from interface:StringGeneratorSpec
Generates an upper case string.- Specified by:
upperCase
in interfaceStringGeneratorSpec
- Returns:
- spec builder
-
mixedCase
Description copied from interface:StringGeneratorSpec
Generates a mixed case string.- Specified by:
mixedCase
in interfaceStringGeneratorSpec
- Returns:
- spec builder
-
alphaNumeric
Description copied from interface:StringGeneratorSpec
Generates a mixed case alphanumeric string.- Specified by:
alphaNumeric
in interfaceStringGeneratorSpec
- Returns:
- spec builder
-
digits
Description copied from interface:StringGeneratorSpec
Generates a string comprised of only digits.- Specified by:
digits
in interfaceStringGeneratorSpec
- Returns:
- spec builder
-
generate
Description copied from interface:Generator
Returns a generated value.If this method produces random data, the data needs to be generated using the provided
Random
instance. This ensures generated values are reproducible for a given seed value.
-