Package org.instancio.generator.specs
Interface StringGeneratorSpec
- All Superinterfaces:
GeneratorSpec<String>,NullableGeneratorSpec<String>
- All Known Subinterfaces:
StringSpec
Generator spec for Strings.
- Since:
- 1.0.1
-
Method Summary
Modifier and TypeMethodDescriptionIndicates that an empty string can be generated.allowEmpty(boolean isAllowed) Indicates if empty string can be generated.Generates an alphanumeric string, upper case by default.digits()Generates a string comprised of only digits.hex()Generates a hexadecimal string, upper case by default.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 thatnullvalue can be generated.Specifies the prefix to prepend to generated strings.Specifies the suffix to append to generated strings.Generates an upper case string.
-
Method Details
-
prefix
Specifies the prefix to prepend to generated strings.- Parameters:
prefix- for generated strings- Returns:
- spec builder
-
suffix
Specifies the suffix to append to generated strings.- Parameters:
suffix- for generated strings- Returns:
- spec builder
- Since:
- 2.7.0
-
allowEmpty
StringGeneratorSpec allowEmpty()Indicates that an empty string can be generated.- Returns:
- spec builder
-
allowEmpty
Indicates if empty string can be generated.- Parameters:
isAllowed- iftrue, empty strings can be generated- Returns:
- spec builder
- Since:
- 2.7.0
-
length
Length of string to generate.- Parameters:
length- exact length to generate- Returns:
- spec builder
-
length
Length of string to generate.- Parameters:
minLength- minimum length (inclusive)maxLength- maximum length (inclusive)- Returns:
- spec builder
-
minLength
Minimum length of string to generate.- Parameters:
length- minimum length (inclusive)- Returns:
- spec builder
-
maxLength
Maximum length of string to generate.- Parameters:
length- maximum length (inclusive)- Returns:
- spec builder
-
lowerCase
StringGeneratorSpec lowerCase()Generates a lower case string.- Returns:
- spec builder
-
upperCase
StringGeneratorSpec upperCase()Generates an upper case string.- Returns:
- spec builder
-
mixedCase
StringGeneratorSpec mixedCase()Generates a mixed case string.- Returns:
- spec builder
-
alphaNumeric
StringGeneratorSpec alphaNumeric()Generates an alphanumeric string, upper case by default.- Returns:
- spec builder
-
digits
StringGeneratorSpec digits()Generates a string comprised of only digits.- Returns:
- spec builder
-
hex
StringGeneratorSpec hex()Generates a hexadecimal string, upper case by default.- Returns:
- spec builder
- Since:
- 2.11.0
-
nullable
StringGeneratorSpec nullable()Description copied from interface:NullableGeneratorSpecIndicates thatnullvalue can be generated.- Specified by:
nullablein interfaceNullableGeneratorSpec<String>- Returns:
- spec builder
-