public class BigDecimalGenerator extends DecimalGenerator<BigDecimal>
Produces values 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) |
protected Predicate<BigDecimal> |
inRange() |
protected BigDecimal |
leastMagnitude() |
protected Function<BigDecimal,BigDecimal> |
narrow() |
protected BigDecimal |
negate(BigDecimal target) |
protected boolean |
negative(BigDecimal target) |
protected Function<BigDecimal,BigDecimal> |
widen() |
doShrinkaddComponentGenerators, canGenerateForParametersOfTypes, canRegisterAsType, canShrink, compatibleWithTypeParameter, configurationAnnotationsOn, configure, configure, hasComponents, narrow, numberOfNeededComponents, provideRepository, shrink, 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 constraintspublic 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>protected Function<BigDecimal,BigDecimal> widen()
widen in class DecimalGenerator<BigDecimal>protected Function<BigDecimal,BigDecimal> narrow()
narrow in class DecimalGenerator<BigDecimal>protected Predicate<BigDecimal> inRange()
inRange in class DecimalGenerator<BigDecimal>protected BigDecimal leastMagnitude()
leastMagnitude in class DecimalGenerator<BigDecimal>protected boolean negative(BigDecimal target)
negative in class DecimalGenerator<BigDecimal>protected BigDecimal negate(BigDecimal target)
negate in class DecimalGenerator<BigDecimal>Copyright © 2016. All rights reserved.