public abstract class EnhancedRandom extends Random
Constructor and Description |
---|
EnhancedRandom() |
Modifier and Type | Method and Description |
---|---|
abstract <T> T |
nextObject(Class<T> type,
String... excludedFields)
Generate a random instance of the given type.
|
abstract <T> java.util.stream.Stream<T> |
objects(Class<T> type,
int amount,
String... excludedFields)
Generate a stream of random instances of the given type.
|
static <T> T |
random(Class<T> type,
String... excludedFields)
Generate a random instance of the given type.
|
static <T> Collection<T> |
randomCollectionOf(int amount,
Class<T> type,
String... excludedFields)
Generate a
Collection of random instances of the given type. |
static <T> List<T> |
randomListOf(int amount,
Class<T> type,
String... excludedFields)
Generate a
List of random instances of the given type. |
static <T> Set<T> |
randomSetOf(int amount,
Class<T> type,
String... excludedFields)
Generate a
Set of random instances of the given type. |
static <T> java.util.stream.Stream<T> |
randomStreamOf(int amount,
Class<T> type,
String... excludedFields)
Generate a stream of random instances of the given type.
|
public static <T> T random(Class<T> type, String... excludedFields)
T
- the target typetype
- the target class typeexcludedFields
- the name of fields to excludepublic static <T> java.util.stream.Stream<T> randomStreamOf(int amount, Class<T> type, String... excludedFields)
T
- the actual type of the target objectsamount
- the number of instances to generatetype
- the type for which instances will be generatedexcludedFields
- the name of fields to excludeObjectGenerationException
- when unable to populate an instance of the given typepublic static <T> List<T> randomListOf(int amount, Class<T> type, String... excludedFields)
List
of random instances of the given type.T
- the actual type of the target objectsamount
- the number of instances to generatetype
- the type for which instances will be generatedexcludedFields
- the name of fields to excludeObjectGenerationException
- when unable to populate an instance of the given typepublic static <T> Set<T> randomSetOf(int amount, Class<T> type, String... excludedFields)
Set
of random instances of the given type.T
- the actual type of the target objectsamount
- the number of instances to generatetype
- the type for which instances will be generatedexcludedFields
- the name of fields to excludeObjectGenerationException
- when unable to populate an instance of the given typepublic static <T> Collection<T> randomCollectionOf(int amount, Class<T> type, String... excludedFields)
Collection
of random instances of the given type.T
- the actual type of the target objectsamount
- the number of instances to generatetype
- the type for which instances will be generatedexcludedFields
- the name of fields to excludeObjectGenerationException
- when unable to populate an instance of the given typepublic abstract <T> T nextObject(Class<T> type, String... excludedFields)
T
- the actual type of the target objecttype
- the type for which an instance will be generatedexcludedFields
- the name of fields to excludeObjectGenerationException
- when unable to populate an instance of the given typepublic abstract <T> java.util.stream.Stream<T> objects(Class<T> type, int amount, String... excludedFields)
T
- the actual type of the target objectstype
- the type for which instances will be generatedamount
- the number of instances to generateexcludedFields
- the name of fields to excludeObjectGenerationException
- when unable to populate an instance of the given typeCopyright © 2017. All Rights Reserved.