Package org.instancio.generator.lang
Class StringGenerator
- All Implemented Interfaces:
Generator<String>
,GeneratorSpec<String>
,StringGeneratorSpec
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIndicates that an empty string can be generated.generate
(RandomProvider random) Returns a generated value.getHints()
Returns hints, including collection sizes and whether values are nullable.length
(int length) Length of string to generate.maxLength
(int length) Maximum length of string to generate.minLength
(int length) Minimum length of string to generate.nullable()
Indicates thatnull
value can be generated.Specifies a String prefix.Methods inherited from class org.instancio.generator.AbstractGenerator
getContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.instancio.Generator
isDelegating, setDelegate, supports, targetClass
Methods inherited from interface org.instancio.generator.GeneratorSpec
name
-
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
-
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
-
generate
Description copied from interface:Generator
Returns a generated value.If the generated value is random, it needs to be generated using the given
RandomProvider
instance. This ensures the data is generated with the same seed value and allows random data to be reproduced by specifying the seed value. -
getHints
Description copied from interface:Generator
Returns hints, including collection sizes and whether values are nullable.
-