T - the type of map generatedpublic abstract class MapGenerator<T extends Map> extends ComponentizedGenerator<T>
Base class for generators of Maps.
The generated map has a number of entries limited by
GenerationStatus.size(), or else by the attributes of a Size
marking. The individual keys and values will have types corresponding to the
property parameter's type arguments.
| Modifier | Constructor and Description |
|---|---|
protected |
MapGenerator(Class<T> type) |
| Modifier and Type | Method and Description |
|---|---|
void |
addComponentGenerators(List<Generator<?>> newComponents) |
void |
configure(Distinct distinct)
Tells this generator to add entries whose keys are distinct from
each other.
|
void |
configure(Size size)
Tells this generator to add key-value pairs to the generated map a
number of times within a specified minimum and/or maximum, inclusive,
chosen with uniform distribution.
|
List<T> |
doShrink(SourceOfRandomness random,
T larger) |
protected T |
empty() |
T |
generate(SourceOfRandomness random,
GenerationStatus status) |
BigDecimal |
magnitude(Object value) |
int |
numberOfNeededComponents() |
protected boolean |
okToAdd(Object key,
Object value) |
canGenerateForParametersOfTypes, canRegisterAsType, componentGenerators, configure, hasComponents, providecanShrink, compatibleWithTypeParameter, configurationAnnotationsOn, configure, copy, gen, gen, narrow, shrink, typespublic void addComponentGenerators(List<Generator<?>> newComponents)
addComponentGenerators in class ComponentizedGenerator<T extends Map>public void configure(Size size)
Tells this generator to add key-value pairs to the generated map a number of times within a specified minimum and/or maximum, inclusive, chosen with uniform distribution.
Note that maps disallow duplicate keys, so the number of pairs added
may not be equal to the map's Map.size().
size - annotation that gives the size constraintspublic void configure(Distinct distinct)
distinct - Keys of generated entries will be distinct if this
param is not nullpublic T generate(SourceOfRandomness random, GenerationStatus status)
public List<T> doShrink(SourceOfRandomness random, T larger)
public int numberOfNeededComponents()
numberOfNeededComponents in class Generator<T extends Map>public BigDecimal magnitude(Object value)
protected final T empty()
Copyright © 2019. All rights reserved.