Class PeriodGenerator
java.lang.Object
org.instancio.internal.generator.AbstractGenerator<Period>
org.instancio.internal.generator.time.PeriodGenerator
- All Implemented Interfaces:
Generator<Period>
,GeneratorSpec<Period>
,NullableGeneratorSpec<Period>
,PeriodGeneratorSpec
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the public API method name of the generator spec.days
(int min, int max) Generate number ofPeriod
days in the given range.Returns a generated value.months
(int min, int max) Generate number ofPeriod
months in the given range.years
(int min, int max) Generate number ofPeriod
years in the given range.Methods inherited from class org.instancio.internal.generator.AbstractGenerator
getContext, hints, isNullable, nullable, nullable
-
Constructor Details
-
PeriodGenerator
-
-
Method Details
-
apiMethod
Description copied from class:AbstractGenerator
Returns the public API method name of the generator spec. The returned name is used for reporting validation errors.- Specified by:
apiMethod
in classAbstractGenerator<Period>
- Returns:
- spec name if defined, or
null
otherwise
-
days
Description copied from interface:PeriodGeneratorSpec
Generate number ofPeriod
days in the given range.- Specified by:
days
in interfacePeriodGeneratorSpec
- Parameters:
min
- minimum number of days (inclusive)max
- maximum number of days (inclusive)- Returns:
- spec builder
-
months
Description copied from interface:PeriodGeneratorSpec
Generate number ofPeriod
months in the given range.- Specified by:
months
in interfacePeriodGeneratorSpec
- Parameters:
min
- minimum number of months (inclusive)max
- maximum number of months (inclusive)- Returns:
- spec builder
-
years
Description copied from interface:PeriodGeneratorSpec
Generate number ofPeriod
years in the given range.- Specified by:
years
in interfacePeriodGeneratorSpec
- Parameters:
min
- minimum number of years (inclusive)max
- maximum number of years (inclusive)- 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.
-