Package org.instancio.generator.array
Class ArrayGenerator<T>
- java.lang.Object
-
- org.instancio.generator.AbstractRandomGenerator<T>
-
- org.instancio.generator.array.ArrayGenerator<T>
-
- All Implemented Interfaces:
Generator<T>
,ArrayGeneratorSpec<T>
,GeneratorSpec<T>
public class ArrayGenerator<T> extends AbstractRandomGenerator<T> implements ArrayGeneratorSpec<T>
-
-
Constructor Summary
Constructors Constructor Description ArrayGenerator(GeneratorContext context)
ArrayGenerator(GeneratorContext context, Class<?> arrayType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
generate()
Returns a generated value.GeneratedHints
getHints()
Returns hints, including collection sizes and whether values are nullable.ArrayGeneratorSpec<T>
maxLength(int length)
ArrayGeneratorSpec<T>
minLength(int length)
ArrayGeneratorSpec<T>
nullable()
ArrayGeneratorSpec<T>
nullableElements()
ArrayGenerator<T>
type(Class<?> type)
-
Methods inherited from class org.instancio.generator.AbstractRandomGenerator
getContext, random
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.instancio.Generator
isDelegating, setDelegate, targetClass
-
-
-
-
Constructor Detail
-
ArrayGenerator
public ArrayGenerator(GeneratorContext context)
-
ArrayGenerator
public ArrayGenerator(GeneratorContext context, Class<?> arrayType)
-
-
Method Detail
-
minLength
public ArrayGeneratorSpec<T> minLength(int length)
- Specified by:
minLength
in interfaceArrayGeneratorSpec<T>
-
maxLength
public ArrayGeneratorSpec<T> maxLength(int length)
- Specified by:
maxLength
in interfaceArrayGeneratorSpec<T>
-
nullable
public ArrayGeneratorSpec<T> nullable()
- Specified by:
nullable
in interfaceArrayGeneratorSpec<T>
-
nullableElements
public ArrayGeneratorSpec<T> nullableElements()
- Specified by:
nullableElements
in interfaceArrayGeneratorSpec<T>
-
type
public ArrayGenerator<T> type(Class<?> type)
- Specified by:
type
in interfaceArrayGeneratorSpec<T>
-
generate
public T generate()
Description copied from interface:Generator
Returns a generated value. By default, generated values are random.Generation parameters for common types such as strings, numbers, collections, etc. can be customised by passing in custom generators.
-
getHints
public GeneratedHints getHints()
Description copied from interface:Generator
Returns hints, including collection sizes and whether values are nullable.
-
-