Class ConcurrentHashMapGenerator<K,V>
- java.lang.Object
-
- org.instancio.generators.AbstractRandomGenerator<Map<K,V>>
-
- org.instancio.generators.collections.MapGenerator<K,V>
-
- org.instancio.generators.collections.ConcurrentHashMapGenerator<K,V>
-
- All Implemented Interfaces:
Generator<Map<K,V>>
,MapGeneratorSpec<K,V>
,GeneratorSpec<Map<K,V>>
public class ConcurrentHashMapGenerator<K,V> extends MapGenerator<K,V>
-
-
Field Summary
-
Fields inherited from class org.instancio.generators.collections.MapGenerator
maxSize, minSize, nullable, nullableKeys, nullableValues, type
-
-
Constructor Summary
Constructors Constructor Description ConcurrentHashMapGenerator(GeneratorContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<K,V>
generate()
Depending on implementation, repeated invocations may return different values.-
Methods inherited from class org.instancio.generators.collections.MapGenerator
getHints, maxSize, minSize, nullable, nullableKeys, nullableValues, type
-
Methods inherited from class org.instancio.generators.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, targetType
-
-
-
-
Constructor Detail
-
ConcurrentHashMapGenerator
public ConcurrentHashMapGenerator(GeneratorContext context)
-
-
Method Detail
-
generate
public Map<K,V> generate()
Description copied from interface:Generator
Depending on implementation, repeated invocations may return different values. Some implementations may return random values on each invocation, while others may return predefined values or random values from a given set.Generators can be passed in as a lambda function. The following example shows how to override generation strategy for certain fields.
Person person = Instancio.of(Person.class) .generate(field("age"), gen -> gen.oneOf(20, 30, 40, 50)) .supply(field("location"), () -> "Canada") .supply(all(LocalDateTime.class), () -> LocalDateTime.now()) .create();
-
-