Interface RandomizerProvider


public interface RandomizerProvider
Strategy interface to provide randomizers for field/type based on the current context. Implementations may (or may not) use registries to provide randomizers. The added value of this interface compared to a simple RandomizerRegistry is that it gives access to the current context and allows fine grained randomizer selection based on that context.
Author:
Mahmoud Ben Hassine ([email protected])
  • Method Details

    • getRandomizerByField

      default Randomizer<?> getRandomizerByField(Field field, RandomizerContext context)
      Return a randomizer for the given field in the current context.
      Parameters:
      field - for which a randomizer should be returned
      context - current randomization context
      Returns:
      a randomizer for the given field in the current context.
    • getRandomizerByType

      default <T> Randomizer<T> getRandomizerByType(Class<T> type, RandomizerContext context)
      Return a randomizer for the given type in the current context.
      Type Parameters:
      T - generic type
      Parameters:
      type - for which a randomizer should be returned
      context - current randomization context
      Returns:
      a randomizer for the given type in the current context.
    • setRandomizerRegistries

      default void setRandomizerRegistries(Set<RandomizerRegistry> randomizerRegistries)
      Set randomizer registries.
      Parameters:
      randomizerRegistries - to set