Package org.instancio.generator.hints
Class CollectionHint.Builder
java.lang.Object
org.instancio.generator.hints.CollectionHint.Builder
- Enclosing class:
CollectionHint
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the object.static CollectionHint.Builder
builder()
generateElements
(int generateElements) Indicates how many elements the engine should generate and insert into the collection.nullableElements
(boolean nullableElements) Indicates whethernull
elements are allowed to be generated.shuffle
(boolean shuffle) Indicates whether collection elements, once populated, should be randomly shuffled.unique
(boolean unique) Indicates that a collection containing unique elements should be generated.withElements
(List<? extends T> elements) Additional elements to be inserted into the collection by the engine during the population process.
-
Method Details
-
builder
-
generateElements
Indicates how many elements the engine should generate and insert into the collection.- Parameters:
generateElements
- number of elements to generate- Returns:
- builder instance
- Since:
- 2.0.0
-
nullableElements
Indicates whethernull
elements are allowed to be generated.- Parameters:
nullableElements
- iftrue
,null
elements allowed- Returns:
- builder instance
- Since:
- 2.0.0
-
shuffle
Indicates whether collection elements, once populated, should be randomly shuffled. The shuffle implementation ensures that results are reproducible per given seed.- Parameters:
shuffle
- iftrue
, elements will be shuffled- Returns:
- builder instance
- Since:
- 2.0.0
-
unique
Indicates that a collection containing unique elements should be generated.- Parameters:
unique
- iftrue
, unique elements will be unique- Returns:
- builder instance
- Since:
- 2.8.0
-
withElements
Additional elements to be inserted into the collection by the engine during the population process. This method can be invoked more than once.- Type Parameters:
T
- element type- Parameters:
elements
- elements to be inserted into the collection in addition to the random elements generated by the engine- Returns:
- builder instance
- Since:
- 2.0.0
-
build
Builds the object.- Returns:
- the built instance.
-