T - the type of objects generatedTheory methods with many parameters,
and will likely go away.@Deprecated public class Fields<T> extends Generator<T>
Produces instances of a class by reflecting the class's fields and generating random values for them.
All fields of the class and its class hierarchy are auto-generated.
In order for this generator to work, the type it is given must have an accessible zero-arg constructor.
If a field is marked with an annotation that influences the generation of a given kind of value, it will be applied to the generation of values for that field.
This generator is intended to be used with
From, and not to be available via the
ServiceLoader mechanism.
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRegisterAsType(Class<?> type)
Deprecated.
Tells whether this generator is allowed to be used for property
parameters of the given type.
|
void |
configure(AnnotatedType annotatedType)
Deprecated.
Configures this generator using annotations from a given annotated
type.
|
T |
generate(SourceOfRandomness random,
GenerationStatus status)
Deprecated.
Produces a value for a property parameter.
|
void |
provideRepository(GeneratorRepository provided)
Deprecated.
Used to supply the available generators to this one.
|
addComponentGenerators, canGenerateForParametersOfTypes, canShrink, compatibleWithTypeParameter, configurationAnnotationsOn, configure, doShrink, hasComponents, narrow, numberOfNeededComponents, shrink, typespublic T 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<T>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 canRegisterAsType(Class<?> type)
GeneratorcanRegisterAsType in class Generator<T>type - type against which to test this generatortrue if the generator is allowed to participate in
generating values for property parameters of typepublic void provideRepository(GeneratorRepository provided)
GeneratorprovideRepository in class Generator<T>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 argumentCopyright © 2016. All rights reserved.