Package org.instancio.generator.time
Class DurationGenerator
java.lang.Object
org.instancio.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.instancio.Generator
apiMethodName, getHints, isDelegating, setDelegate, supports, targetClass
-
Constructor Details
-
DurationGenerator
public 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 the generated value is random, it needs to be generated using the given
Random
instance. This ensures the data is generated with the same seed value and allows random data to be reproduced by specifying the seed value.
-