Class DurationGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<Duration>
org.instancio.internal.generator.time.DurationGenerator
- All Implemented Interfaces:
Generator<Duration>
,GeneratorSpec<Duration>
,DurationGeneratorSpec
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAllow aDuration
of length zero to be generated.Returns a generated value.of
(long minAmount, long maxAmount, TemporalUnit unit) Generate aDuration
in the given range, measured in specified units.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
getContext, hints
-
Constructor Details
-
DurationGenerator
-
-
Method Details
-
of
Description copied from interface:DurationGeneratorSpec
Generate aDuration
in the given range, measured in specified units.- Specified by:
of
in interfaceDurationGeneratorSpec
- Parameters:
minAmount
- minimum duration amount (inclusive)maxAmount
- maximum duration amount (inclusive)unit
- unit the duration is measured in- Returns:
- spec builder
-
allowZero
Description copied from interface:DurationGeneratorSpec
Allow aDuration
of length zero to be generated.- Specified by:
allowZero
in interfaceDurationGeneratorSpec
- Returns:
- spec builder
-
generate
Description copied from interface:Generator
Returns a generated value.If this method produces random data, the data needs to be generated using the provided
Random
instance. This ensures generated values are reproducible for a given seed value.
-