Package org.instancio.generator.specs
Interface OneOfCollectionSpec<T>
- Type Parameters:
T- type of value
- All Superinterfaces:
GeneratorSpec<T>,OneOfCollectionGeneratorSpec<T>,ValueSpec<T>
- All Known Implementing Classes:
OneOfCollectionGenerator
Spec for selecting a random value from a collection.
- Since:
- 2.6.0
-
Method Summary
Modifier and TypeMethodDescriptiononeOf(Collection<T> values) Selects a random value from the given choices.toModel()Returns the spec as aModel.
-
Method Details
-
oneOf
Description copied from interface:OneOfCollectionGeneratorSpecSelects a random value from the given choices.- Specified by:
oneOfin interfaceOneOfCollectionGeneratorSpec<T>- Parameters:
values- from which a random value will be selected- Returns:
- completed spec with no further methods
-
toModel
Description copied from interface:ValueSpecReturns the spec as aModel.Example:
Model<String> stringModel = Gen.string().length(10).digits().toModel(); String result = Instancio.create(stringModel);
-