Package org.instancio.generator.specs
Interface EmitGeneratorSpec<T>
- All Superinterfaces:
GeneratorSpec<T>
- All Known Implementing Classes:
EmitGenerator
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.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.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:
-
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 aMapkeyn- number of times the item should be emitted; must not be negative- Returns:
- spec builder
- Since:
- 2.12.0
- See Also:
-
shuffle
EmitGenerator<T> shuffle()Specifies that items should be emitted in random order.- Returns:
- spec builder
- Since:
- 2.12.0
-
ignoreUnused
EmitGenerator<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
EmitGenerator<T> whenEmptyEmitNull()Specifies thatnullshould be generated if an insufficient number of items were provided.- Returns:
- spec builder
- Since:
- 2.12.0
-
whenEmptyEmitRandom
EmitGenerator<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
EmitGenerator<T> whenEmptyThrowException()Specifies that an exception should be raised if an insufficient number of items were provided.- Returns:
- spec builder
- Since:
- 2.12.0
-