T
- the type of map generatedpublic abstract class MapGenerator<T extends Map> extends ComponentizedGenerator<T>
Base class for generators of Map
s.
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 |
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) |
int |
numberOfNeededComponents() |
protected boolean |
okToAdd(Object key,
Object value) |
addComponentGenerators, canGenerateForParametersOfTypes, canRegisterAsType, componentGenerators, configure, hasComponents, provide
canShrink, compatibleWithTypeParameter, configurationAnnotationsOn, configure, gen, narrow, shrink, types
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 T generate(SourceOfRandomness random, GenerationStatus status)
public List<T> doShrink(SourceOfRandomness random, T larger)
public int numberOfNeededComponents()
numberOfNeededComponents
in class Generator<T extends Map>
protected final T empty()
© Copyright 2010-2016 Paul R. Holser, Jr. All rights reserved. Licensed under The MIT License. pholser@alumni.rice.edu