Class AbstractGenerator<T>

java.lang.Object
org.instancio.internal.generator.AbstractGenerator<T>
Type Parameters:
T - type generated by this generator
All Implemented Interfaces:
Generator<T>, GeneratorSpec<T>
Direct Known Subclasses:
AbstractRandomNumberGeneratorSpec, ArrayGenerator, BooleanGenerator, CalendarGenerator, CharacterGenerator, CollectionGenerator, DateGenerator, DurationGenerator, EnumSetGenerator, InstantGenerator, LocalDateGenerator, LocalDateTimeGenerator, LocalTimeGenerator, LoremIpsumGenerator, MapGenerator, OneOfArrayGenerator, OneOfCollectionGenerator, OptionalGenerator, PeriodGenerator, SqlDateGenerator, StringBuilderGenerator, StringGenerator, TextPatternGenerator, TimestampGenerator, UUIDGenerator, UUIDStringGenerator, XMLGregorianCalendarGenerator, YearGenerator, YearMonthGenerator, ZonedDateTimeGenerator

@InternalApi public abstract class AbstractGenerator<T> extends Object implements Generator<T>
Base class for all internal generators.
  • Constructor Details

  • Method Details

    • getContext

      public GeneratorContext getContext()
    • hints

      public Hints hints()
      Description copied from interface: Generator
      Hints provided by the generator to the engine.

      The most important hint for custom generators is AfterGenerate. This hint indicates whether the object created by this generator:

      • should be populated (for example, if it has null fields)
      • can be modified using selectors

      For example, setting the hint to AfterGenerate.POPULATE_NULLS will cause Instancio to populate null fields on the object returned by this generator:

      
         @Override
         public Hints hints() {
             return Hints.afterGenerate(AfterGenerate.POPULATE_NULLS);
         }
       

      If the action is not specified, default behaviour will be based on the AfterGenerate value configured in the Settings using the key Keys.AFTER_GENERATE_HINT.

      In addition, the following hints can be provided for populating data structures:

      Specified by:
      hints in interface Generator<T>
      Returns:
      hints from this generator to the engine
      See Also: