@Experimental public class UniqueValues extends Object
Constructor and Description |
---|
UniqueValues() |
Modifier and Type | Method and Description |
---|---|
void |
setMaxRetries(int maxRetries) |
<T> T |
value(String uniquenessGroup,
Supplier<T> supplier)
Invokes supplier until it returns a value unique within
uniquenessGroup or the max retry limit is
reached. |
public void setMaxRetries(int maxRetries)
maxRetries
- how many times a random value may be generated during one invocationpublic <T> T value(String uniquenessGroup, Supplier<T> supplier)
uniquenessGroup
or the max retry limit is
reached.T
- the type of value to returnuniquenessGroup
- id of the group within which the generated value should be uniquesupplier
- the value supplierUniqueValueRetryLimitExceededException
- if retry limit is exceededCopyright © 2020. All rights reserved.