Interface OneOfArrayGeneratorSpec<T>
- Type Parameters:
T- type of value
- All Superinterfaces:
AsGeneratorSpec<T>,GeneratorSpec<T>,NullableGeneratorSpec<T>
Generator spec for selecting a random value from an array.
- Since:
- 1.0.1
-
Method Summary
Modifier and TypeMethodDescriptionnullable()Indicates thatnullvalue can be generated.Selects a random value from the given choices.orRandom()Allows the generator to produce either one of the preset values defined viaoneOf(Object...)or a random value of the target type.Methods inherited from interface org.instancio.generator.specs.AsGeneratorSpec
as, asString
-
Method Details
-
oneOf
Selects a random value from the given choices.- Parameters:
values- from which a random value will be selected- Returns:
- spec builder
- Since:
- 1.0.1
-
nullable
OneOfArrayGeneratorSpec<T> nullable()Indicates thatnullvalue can be generated.- Specified by:
nullablein interfaceNullableGeneratorSpec<T>- Returns:
- spec builder
-
orRandom
NullableGeneratorSpec<T> orRandom()Allows the generator to produce either one of the preset values defined viaoneOf(Object...)or a random value of the target type.- Returns:
- spec builder
- Since:
- 5.4.0
-