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 givenitemnnumber of times.Emit givenitems.Emit givenitems.shuffle()Specifies that items should be emitted in random order.Specifies thatnullshould 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 (default behaviour).Specifies that the same items should be re-emitted again if provided items are exhausted.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,nullarray is not allowed, but the array itself may containnullelements unless the target is aMapkey- 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,nulliterable is not allowed, but the iterable itself may containnullelements unless the target is aMapkey- Returns:
- spec builder
- Since:
- 2.13.0
- See Also:
-
item
Emit givenitemnnumber of times.This method can be invoked multiple times and combined with
items(Object[]).- Parameters:
item- to emit,nullallowed unless the target is aMapkeyemitCount- 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 thatnullshould 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 (default behaviour).- 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
-
whenEmptyRecycle
EmitGeneratorSpec<T> whenEmptyRecycle()Specifies that the same items should be re-emitted again if provided items are exhausted.- Returns:
- spec builder
- Since:
- 4.3.0
-