public class BigDecimalGenerator extends Generator<BigDecimal>
Produces values for theory parameters of type BigDecimal.
With no additional configuration, the generated values are chosen from a range with a magnitude decided by
GenerationStatus.size().
| Constructor and Description |
|---|
BigDecimalGenerator() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(InRange range)
|
void |
configure(Precision configuration)
Tells this generator to produce values that have a specified scale.
|
BigDecimal |
generate(SourceOfRandomness random,
GenerationStatus status) |
addComponentGenerators, canGenerateForParametersOfTypes, canRegisterAsType, compatibleWithTypeParameter, configure, hasComponents, numberOfNeededComponents, provideRepository, typespublic void configure(InRange range)
Tells this generator to produce values within a specified minimum (inclusive) and/or maximum (exclusive), with uniform distribution.
If an endpoint of the range is not specified, its value takes on a magnitude influenced by
GenerationStatus.size().
range - annotation that gives the range's constraintsNumberFormatException - if the range's values cannot be converted to BigDecimalIllegalArgumentException - if the range's values specify a nonsensical rangepublic void configure(Precision configuration)
Tells this generator to produce values that have a specified scale.
With no precision constraint and no min/max constraint, the scale of the generated values is unspecified.
Otherwise, the scale of the generated values is set as max(0, precision.scale, range.min.scale,
range.max.scale).
configuration - annotation that gives the desired scale of the generated valuespublic BigDecimal generate(SourceOfRandomness random, GenerationStatus status)
generate in class Generator<BigDecimal>Copyright © 2015. All Rights Reserved.