public class EasyRandom
extends java.util.Random
Random
that is able to generate random Java objects.Constructor and Description |
---|
EasyRandom()
Create a new
EasyRandom instance with default parameters. |
EasyRandom(EasyRandomParameters easyRandomParameters)
Create a new
EasyRandom instance. |
Modifier and Type | Method and Description |
---|---|
<T> T |
nextObject(java.lang.Class<T> type)
Generate a random instance of the given type.
|
<T> java.util.stream.Stream<T> |
objects(java.lang.Class<T> type,
int streamSize)
Generate a stream of random instances of the given type.
|
public EasyRandom()
EasyRandom
instance with default parameters.public EasyRandom(EasyRandomParameters easyRandomParameters)
EasyRandom
instance.easyRandomParameters
- randomization parameterspublic <T> T nextObject(java.lang.Class<T> type)
T
- the actual type of the target objecttype
- the type for which an instance will be generatedObjectCreationException
- when unable to create a new instance of the given typepublic <T> java.util.stream.Stream<T> objects(java.lang.Class<T> type, int streamSize)
T
- the actual type of the target objectstype
- the type for which instances will be generatedstreamSize
- the number of instances to generateObjectCreationException
- when unable to create a new instance of the given typeCopyright © 2019. All Rights Reserved.