Package org.instancio.generator.util
Interface CollectionGeneratorSpec<T>
- Type Parameters:
T
- element type
- All Superinterfaces:
GeneratorSpec<Collection<T>>
- All Known Implementing Classes:
CollectionGenerator
,CollectionGeneratorSpecImpl
,HashSetGenerator
,TreeSetGenerator
Generator spec for collections.
-
Method Summary
Modifier and TypeMethodDescriptionmaxSize
(int size) Maximum size of collection to generate.minSize
(int size) Minimum size of collection to generate.nullable()
Indicates thatnull
value can be generated for the collection.Indicates thatnull
values can be generated for collection elements.size
(int size) Size of collection to generate.Specifies the type of collection that should be generated.Adds given elements to the generated collection.Methods inherited from interface org.instancio.generator.GeneratorSpec
name
-
Method Details
-
size
Size of collection to generate.- Parameters:
size
- of collection- Returns:
- spec builder
-
minSize
Minimum size of collection to generate.- Parameters:
size
- minimum size (inclusive)- Returns:
- spec builder
-
maxSize
Maximum size of collection to generate.- Parameters:
size
- maximum size (inclusive)- Returns:
- spec builder
-
nullable
CollectionGeneratorSpec<T> nullable()Indicates thatnull
value can be generated for the collection.- Returns:
- spec builder
-
nullableElements
CollectionGeneratorSpec<T> nullableElements()Indicates thatnull
values can be generated for collection elements.- Returns:
- spec builder
-
type
Specifies the type of collection that should be generated.- Parameters:
type
- of collection to generate- Returns:
- spec builder
-
with
Adds given elements to the generated collection.If the collection is a List, elements will be added at random positions; otherwise elements will be added via
Collection.addAll(Collection)
after the collection has been generated.- Parameters:
elements
- to add- Returns:
- spec builder
-