| Constructor and Description |
|---|
CompositeGenerator(List<Weighted<Generator<?>>> composed) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canShrink(Object larger)
Tells whether this generator is allowed to participate in the
Shrink process for the given "larger" value. |
Generator<?> |
composed(int index) |
void |
configure(AnnotatedElement element) |
void |
configure(AnnotatedType annotatedType)
Configures this generator using annotations from a given annotated
type.
|
List<Object> |
doShrink(SourceOfRandomness random,
Object larger)
Gives some objects that are "smaller" than a given "larger"
object.
|
Object |
generate(SourceOfRandomness random,
GenerationStatus status)
Produces a value for a property parameter.
|
int |
numberOfComposedGenerators() |
void |
provideRepository(GeneratorRepository provided)
Used to supply the available generators to this one.
|
addComponentGenerators, canGenerateForParametersOfTypes, canRegisterAsType, compatibleWithTypeParameter, configurationAnnotationsOn, hasComponents, narrow, numberOfNeededComponents, shrink, typespublic Object generate(SourceOfRandomness random, GenerationStatus status)
GeneratorProduces a value for a property parameter.
A generator may raise an unchecked exception if some condition exists which would lead to a confusing generation -- for example, if a generator honored a "range" configuration, and the endpoints were transposed.
generate in class Generator<Object>random - source of randomness to be used when generating the valuestatus - an object that the generator can use to influence the
value it produces. For example, a generator for lists can use the
size method to generate lists with a
given number of elements.public boolean canShrink(Object larger)
GeneratorTells whether this generator is allowed to participate in the
Shrink process for the given "larger" value.
Unless overridden, the only criterion for whether a generator is allowed to participate in shrinking a value is if the value can be safely cast to the type of values the generator produces.
public List<Object> doShrink(SourceOfRandomness random, Object larger)
GeneratorGives some objects that are "smaller" than a given "larger" object.
Unless overridden, a generator will produce an empty list of "smaller" values.
public Generator<?> composed(int index)
public int numberOfComposedGenerators()
public void provideRepository(GeneratorRepository provided)
GeneratorprovideRepository in class Generator<Object>provided - repository of available generatorspublic void configure(AnnotatedType annotatedType)
GeneratorConfigures this generator using annotations from a given annotated type.
This method considers only annotations that are themselves marked
with GeneratorConfiguration.
By default, the generator will configure itself using this procedure:
public method on the generator named
configure, that accepts a single parameter of the
annotation typeconfigure method reflectively, passing the
annotation as the argumentpublic void configure(AnnotatedElement element)
configure in class Generator<Object>element - an annotated program elementCopyright © 2016. All rights reserved.