Class MapEntryGenerator<K,V>

java.lang.Object
org.instancio.internal.generator.AbstractGenerator<Map.Entry<K,V>>
org.instancio.internal.generator.util.MapEntryGenerator<K,V>
All Implemented Interfaces:
Generator<Map.Entry<K,V>>, GeneratorSpec<Map.Entry<K,V>>, NullableGeneratorSpec<Map.Entry<K,V>>

public class MapEntryGenerator<K,V> extends AbstractGenerator<Map.Entry<K,V>>
  • Constructor Details

  • Method Details

    • apiMethod

      public String 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 class AbstractGenerator<Map.Entry<K,V>>
      Returns:
      spec name if defined, or null otherwise
    • tryGenerateNonNull

      public Map.Entry<K,V> tryGenerateNonNull(Random random)
      Description copied from class: AbstractGenerator
      Makes the best effort to return a non-null value. However, in certain cases this method will produce a null.
      Specified by:
      tryGenerateNonNull in class AbstractGenerator<Map.Entry<K,V>>
      Parameters:
      random - for generating the value
      Returns:
      generated value, either a null or non-null
    • 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<K>
      Overrides:
      hints in class AbstractGenerator<Map.Entry<K,V>>
      Returns:
      hints from this generator to the engine
      See Also: