Class PeriodGenerator

java.lang.Object
org.instancio.generator.time.PeriodGenerator
All Implemented Interfaces:
Generator<Period>, GeneratorSpec<Period>, PeriodGeneratorSpec

public class PeriodGenerator extends Object implements Generator<Period>, PeriodGeneratorSpec
  • Constructor Details

    • PeriodGenerator

      public PeriodGenerator()
  • Method Details

    • days

      public PeriodGeneratorSpec days(int min, int max)
      Description copied from interface: PeriodGeneratorSpec
      Generate number of Period days in the given range.
      Specified by:
      days in interface PeriodGeneratorSpec
      Parameters:
      min - minimum number of days (inclusive)
      max - maximum number of days (inclusive)
      Returns:
      spec builder
    • months

      public PeriodGeneratorSpec months(int min, int max)
      Description copied from interface: PeriodGeneratorSpec
      Generate number of Period months in the given range.
      Specified by:
      months in interface PeriodGeneratorSpec
      Parameters:
      min - minimum number of months (inclusive)
      max - maximum number of months (inclusive)
      Returns:
      spec builder
    • years

      public PeriodGeneratorSpec years(int min, int max)
      Description copied from interface: PeriodGeneratorSpec
      Generate number of Period years in the given range.
      Specified by:
      years in interface PeriodGeneratorSpec
      Parameters:
      min - minimum number of years (inclusive)
      max - maximum number of years (inclusive)
      Returns:
      spec builder
    • generate

      public Period generate(Random random)
      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.

      Specified by:
      generate in interface Generator<Period>
      Parameters:
      random - provider for generating random values
      Returns:
      generated value