Package org.instancio
Class Generators
- java.lang.Object
-
- org.instancio.Generators
-
public class Generators extends Object
Provides built-in generators for overriding data generation parameters such as number ranges, collection sizes, string lengths, etc.
-
-
Constructor Summary
Constructors Constructor Description Generators(GeneratorContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> ArrayGeneratorSpec<T>
array()
Creates a spec builder for arrays.NumberGeneratorSpec<BigDecimal>
bigDecimal()
NumberGeneratorSpec<BigInteger>
bigInteger()
NumberGeneratorSpec<Byte>
bytes()
<T> CollectionGeneratorSpec<Collection<T>>
collection()
Creates a spec builder forCollection
and its subtypes.NumberGeneratorSpec<Double>
doubles()
NumberGeneratorSpec<Float>
floats()
NumberGeneratorSpec<Integer>
ints()
NumberGeneratorSpec<Long>
longs()
<K,V>
MapGeneratorSpec<K,V>map()
Creates a spec builder forMap
and its subtypes.<T> OneOfCollectionGeneratorSpec<T>
oneOf(Collection<T> values)
<T> OneOfArrayGeneratorSpec<T>
oneOf(T... values)
NumberGeneratorSpec<Short>
shorts()
StringGeneratorSpec
string()
-
-
-
Constructor Detail
-
Generators
public Generators(GeneratorContext context)
-
-
Method Detail
-
string
public StringGeneratorSpec string()
-
bytes
public NumberGeneratorSpec<Byte> bytes()
-
shorts
public NumberGeneratorSpec<Short> shorts()
-
ints
public NumberGeneratorSpec<Integer> ints()
-
longs
public NumberGeneratorSpec<Long> longs()
-
floats
public NumberGeneratorSpec<Float> floats()
-
doubles
public NumberGeneratorSpec<Double> doubles()
-
bigInteger
public NumberGeneratorSpec<BigInteger> bigInteger()
-
bigDecimal
public NumberGeneratorSpec<BigDecimal> bigDecimal()
-
oneOf
@SafeVarargs public final <T> OneOfArrayGeneratorSpec<T> oneOf(T... values)
-
oneOf
public final <T> OneOfCollectionGeneratorSpec<T> oneOf(Collection<T> values)
-
array
public <T> ArrayGeneratorSpec<T> array()
Creates a spec builder for arrays.- Type Parameters:
T
- array component type- Returns:
- spec builder
-
collection
public <T> CollectionGeneratorSpec<Collection<T>> collection()
Creates a spec builder forCollection
and its subtypes.- Type Parameters:
T
- element type- Returns:
- spec builder
-
map
public <K,V> MapGeneratorSpec<K,V> map()
Creates a spec builder forMap
and its subtypes.- Type Parameters:
K
- key typeV
- value type- Returns:
- spec builder
-
-