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 Detail

      • getRandomizerByField

        default Randomizer<?> getRandomizerByField​(java.lang.reflect.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​(java.lang.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​(java.util.Set<RandomizerRegistry> randomizerRegistries)
        Set randomizer registries.
        Parameters:
        randomizerRegistries - to set