E - the type of elements in the enumerationpublic class EnumRandomizer<E extends Enum<E>> extends AbstractRandomizer<E>
Randomizer that generates a random value from a given Enum.random| Constructor and Description |
|---|
EnumRandomizer(Class<E> enumeration)
Create a new
EnumRandomizer. |
EnumRandomizer(Class<E> enumeration,
E... excludedValues)
Create a new
EnumRandomizer. |
EnumRandomizer(Class<E> enumeration,
long seed)
Create a new
EnumRandomizer. |
| Modifier and Type | Method and Description |
|---|---|
static <E extends Enum<E>> |
aNewEnumRandomizer(Class<E> enumeration)
Create a new
EnumRandomizer. |
static <E extends Enum<E>> |
aNewEnumRandomizer(Class<E> enumeration,
E... excludedValues)
Create a new
EnumRandomizer. |
static <E extends Enum<E>> |
aNewEnumRandomizer(Class<E> enumeration,
long seed)
Create a new
EnumRandomizer. |
E |
getRandomValue()
Get a random value within an enumeration or an enumeration subset (when values are excluded)
|
getPredefinedValuesOf, toStringpublic EnumRandomizer(Class<E> enumeration)
EnumRandomizer.enumeration - the enumeration from which this randomizer will generate random valuespublic EnumRandomizer(Class<E> enumeration, long seed)
EnumRandomizer.enumeration - the enumeration from which this randomizer will generate random valuesseed - the initial seedpublic EnumRandomizer(Class<E> enumeration, E... excludedValues) throws IllegalArgumentException
EnumRandomizer.enumeration - the enumeration from which this randomizer will generate random valuesexcludedValues - the values to exclude from random pickingIllegalArgumentException - when excludedValues contains all enumeration values,
ie all elements from the enumeration are excludedpublic static <E extends Enum<E>> EnumRandomizer<E> aNewEnumRandomizer(Class<E> enumeration)
EnumRandomizer.E - the type of elements in the enumerationenumeration - the enumeration from which this randomizer will generate random valuesEnumRandomizer.public static <E extends Enum<E>> EnumRandomizer<E> aNewEnumRandomizer(Class<E> enumeration, long seed)
EnumRandomizer.E - the type of elements in the enumerationenumeration - the enumeration from which this randomizer will generate random valuesseed - the initial seedEnumRandomizer.public static <E extends Enum<E>> EnumRandomizer<E> aNewEnumRandomizer(Class<E> enumeration, E... excludedValues)
EnumRandomizer.E - the type of elements in the enumerationenumeration - the enumeration from which this randomizer will generate random valuesexcludedValues - the values to exclude from the subset in which the random value will be pickedEnumRandomizer.public E getRandomValue()
Copyright © 2017. All Rights Reserved.