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 theory parameter's type arguments.
| Modifier | Constructor and Description |
|---|---|
protected |
MapGenerator(Class<T> type) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRegisterAsType(Class<?> type) |
void |
configure(Size sizeRange)
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.
|
protected abstract T |
emptyMap() |
T |
generate(SourceOfRandomness random,
GenerationStatus status) |
int |
numberOfNeededComponents() |
protected boolean |
okToAdd(Object key,
Object value) |
addComponentGenerators, canGenerateForParametersOfTypes, componentGenerators, configure, hasComponents, provideRepositorycompatibleWithTypeParameter, typespublic void configure(Size sizeRange)
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().
sizeRange - annotation that gives the size constraintspublic T generate(SourceOfRandomness random, GenerationStatus status)
public int numberOfNeededComponents()
numberOfNeededComponents in class Generator<T extends Map>public boolean canRegisterAsType(Class<?> type)
canRegisterAsType in class Generator<T extends Map>protected abstract T emptyMap()
Copyright © 2015. All Rights Reserved.