Package org.instancio.generator.specs
Interface StringSpec
- All Superinterfaces:
GeneratorSpec<String>,NullableGeneratorSpec<String>,StringGeneratorSpec,ValueSpec<String>
Spec for generating
String values.- Since:
- 2.6.0
-
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()Specifies that anullvalue can be generatedSpecifies the prefix to prepend to generated strings.Specifies the suffix to append to generated strings.Generates an upper case string.
-
Method Details
-
prefix
Description copied from interface:StringGeneratorSpecSpecifies the prefix to prepend to generated strings.- Specified by:
prefixin interfaceStringGeneratorSpec- Parameters:
prefix- for generated strings- Returns:
- spec builder
-
suffix
Description copied from interface:StringGeneratorSpecSpecifies the suffix to append to generated strings.- Specified by:
suffixin interfaceStringGeneratorSpec- Parameters:
suffix- for generated strings- Returns:
- spec builder
-
nullable
StringSpec nullable()Description copied from interface:ValueSpecSpecifies that anullvalue can be generated- Specified by:
nullablein interfaceNullableGeneratorSpec<String>- Specified by:
nullablein interfaceStringGeneratorSpec- Specified by:
nullablein interfaceValueSpec<String>- Returns:
- spec builder reference
-
allowEmpty
StringSpec allowEmpty()Description copied from interface:StringGeneratorSpecIndicates that an empty string can be generated.- Specified by:
allowEmptyin interfaceStringGeneratorSpec- Returns:
- spec builder
-
allowEmpty
Description copied from interface:StringGeneratorSpecIndicates if empty string can be generated.- Specified by:
allowEmptyin interfaceStringGeneratorSpec- Parameters:
isAllowed- iftrue, empty strings can be generated- Returns:
- spec builder
-
length
Description copied from interface:StringGeneratorSpecLength of string to generate.- Specified by:
lengthin interfaceStringGeneratorSpec- Parameters:
length- exact length to generate- Returns:
- spec builder
-
length
Description copied from interface:StringGeneratorSpecLength of string to generate.- Specified by:
lengthin interfaceStringGeneratorSpec- Parameters:
minLength- minimum length (inclusive)maxLength- maximum length (inclusive)- Returns:
- spec builder
-
minLength
Description copied from interface:StringGeneratorSpecMinimum length of string to generate.- Specified by:
minLengthin interfaceStringGeneratorSpec- Parameters:
length- minimum length (inclusive)- Returns:
- spec builder
-
maxLength
Description copied from interface:StringGeneratorSpecMaximum length of string to generate.- Specified by:
maxLengthin interfaceStringGeneratorSpec- Parameters:
length- maximum length (inclusive)- Returns:
- spec builder
-
lowerCase
StringSpec lowerCase()Description copied from interface:StringGeneratorSpecGenerates a lower case string.- Specified by:
lowerCasein interfaceStringGeneratorSpec- Returns:
- spec builder
-
upperCase
StringSpec upperCase()Description copied from interface:StringGeneratorSpecGenerates an upper case string.- Specified by:
upperCasein interfaceStringGeneratorSpec- Returns:
- spec builder
-
mixedCase
StringSpec mixedCase()Description copied from interface:StringGeneratorSpecGenerates a mixed case string.- Specified by:
mixedCasein interfaceStringGeneratorSpec- Returns:
- spec builder
-
alphaNumeric
StringSpec alphaNumeric()Description copied from interface:StringGeneratorSpecGenerates an alphanumeric string, upper case by default.- Specified by:
alphaNumericin interfaceStringGeneratorSpec- Returns:
- spec builder
-
digits
StringSpec digits()Description copied from interface:StringGeneratorSpecGenerates a string comprised of only digits.- Specified by:
digitsin interfaceStringGeneratorSpec- Returns:
- spec builder
-
hex
StringSpec hex()Generates a hexadecimal string, upper case by default.- Specified by:
hexin interfaceStringGeneratorSpec- Returns:
- spec builder
- Since:
- 2.11.0
-