Package io.github.krandom.api
Interface RandomizerProvider
-
- All Implemented Interfaces:
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.
Mahmoud Ben Hassine ([email protected])
-
-
Method Summary
Modifier and Type Method Description Randomizer<?>
getRandomizerByField(Field field, RandomizerContext context)
Return a randomizer for the given field in the current context. <T extends Any> Randomizer<T>
getRandomizerByType(Class<T> type, RandomizerContext context)
Return a randomizer for the given type in the current context. abstract Unit
setRandomizerRegistries(Set<RandomizerRegistry> randomizerRegistries)
Set randomizer registries. -
-
Method Detail
-
getRandomizerByField
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 returnedcontext
- current randomization context- Returns:
a randomizer for the given field in the current context.
-
getRandomizerByType
<T extends Any> Randomizer<T> getRandomizerByType(Class<T> type, RandomizerContext context)
Return a randomizer for the given type in the current context.
- Parameters:
type
- for which a randomizer should be returnedcontext
- current randomization context- Returns:
a randomizer for the given type in the current context. </T>
-
setRandomizerRegistries
abstract Unit setRandomizerRegistries(Set<RandomizerRegistry> randomizerRegistries)
Set randomizer registries.
- Parameters:
randomizerRegistries
- to set
-
-
-
-