Package org.instancio.generator.specs
Interface EmitGeneratorSpec<T>
- All Superinterfaces:
GeneratorSpec<T>
A generator spec that emits given items to a selector's target.
- Since:
- 2.12.0
-
Method Summary
Modifier and TypeMethodDescriptionSpecifies that if any of the provided items were not emitted, they should be ignored (the default is to throw an exception).Emit givenitem
n
number of times.Emit givenitems
.Emit givenitems
.shuffle()
Specifies that items should be emitted in random order.Specifies thatnull
should be generated if an insufficient number of items were provided.Specifies that a random value should be generated if an insufficient number of items were provided.Specifies that an exception should be raised if an insufficient number of items were provided.
-
Method Details
-
items
Emit givenitems
.This method can be invoked multiple times to add more items to emit.
- Parameters:
items
- to emit,null
array is not allowed, but the array itself may containnull
elements unless the target is aMap
key- Returns:
- spec builder
- Since:
- 2.12.0
- See Also:
-
items
Emit givenitems
.This method can be invoked multiple times to add more items to emit.
- Parameters:
items
- to emit,null
iterable is not allowed, but the iterable itself may containnull
elements unless the target is aMap
key- Returns:
- spec builder
- Since:
- 2.13.0
- See Also:
-
item
Emit givenitem
n
number of times.This method can be invoked multiple times and combined with
items(Object[])
.- Parameters:
item
- to emit,null
allowed unless the target is aMap
keyn
- number of times the item should be emitted; must not be negative- Returns:
- spec builder
- Since:
- 2.12.0
- See Also:
-
shuffle
EmitGeneratorSpec<T> shuffle()Specifies that items should be emitted in random order.- Returns:
- spec builder
- Since:
- 2.12.0
-
ignoreUnused
EmitGeneratorSpec<T> ignoreUnused()Specifies that if any of the provided items were not emitted, they should be ignored (the default is to throw an exception).- Returns:
- spec builder
- Since:
- 2.12.0
-
whenEmptyEmitNull
EmitGeneratorSpec<T> whenEmptyEmitNull()Specifies thatnull
should be generated if an insufficient number of items were provided.- Returns:
- spec builder
- Since:
- 2.12.0
-
whenEmptyEmitRandom
EmitGeneratorSpec<T> whenEmptyEmitRandom()Specifies that a random value should be generated if an insufficient number of items were provided.- Returns:
- spec builder
- Since:
- 2.12.0
-
whenEmptyThrowException
EmitGeneratorSpec<T> whenEmptyThrowException()Specifies that an exception should be raised if an insufficient number of items were provided.- Returns:
- spec builder
- Since:
- 2.12.0
-