Package org.instancio.generator.util
Class MapGeneratorSpecImpl<K,V>
java.lang.Object
org.instancio.generator.AbstractGenerator<Map<K,V>>
org.instancio.generator.util.MapGenerator<K,V>
org.instancio.generator.util.MapGeneratorSpecImpl<K,V>
- All Implemented Interfaces:
Generator<Map<K,
,V>> GeneratorSpec<Map<K,
,V>> MapGeneratorSpec<K,
V>
-
Field Summary
Fields inherited from class org.instancio.generator.util.MapGenerator
maxSize, minSize, nullable, nullableKeys, nullableValues, type
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongenerate
(RandomProvider random) Returns a generated value.boolean
Iftrue
, then this generator delegate object instantiation to another generator supplied viaGenerator.setDelegate(Generator)
.void
setDelegate
(Generator<?> delegate) Set a delegate that will be responsible for instantiating an object on behalf of this generator.Target class to generate.Methods inherited from class org.instancio.generator.util.MapGenerator
getHints, maxSize, minSize, nullable, nullableKeys, nullableValues, size, type
Methods inherited from class org.instancio.generator.AbstractGenerator
getContext
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.GeneratorSpec
name
-
Constructor Details
-
MapGeneratorSpecImpl
-
-
Method Details
-
generate
Description copied from interface:Generator
Returns a generated value.If the generated value is random, it needs to be generated using the given
RandomProvider
instance. This ensures the data is generated with the same seed value and allows random data to be reproduced by specifying the seed value. -
isDelegating
public boolean isDelegating()Description copied from interface:Generator
Iftrue
, then this generator delegate object instantiation to another generator supplied viaGenerator.setDelegate(Generator)
.- Returns:
true
if this is a delegating generator
-
setDelegate
Description copied from interface:Generator
Set a delegate that will be responsible for instantiating an object on behalf of this generator.- Parameters:
delegate
- that will create the target object
-
targetClass
Description copied from interface:Generator
Target class to generate.If
Optional.empty()
is returned, it will default to the field type for fields, and element type for collection and array elements.If the type is an interface, such as
Set
, will generate a default implementation class such asHashSet
.- Returns:
- target class
-