Package dev.orne.test.rnd.params
Interface ParameterizableGenerator
- All Superinterfaces:
Generator
- All Known Subinterfaces:
TypedParameterizableGenerator<T>
- All Known Implementing Classes:
AbstractParameterizableGenerator,AbstractTypedParameterizableGenerator,ListGenerator,MapGenerator,SetGenerator,StringGenerator
Interface for random value generators with optional parameters.
- Since:
- 0.1
- Version:
- 1.0, 2022-11
- Author:
- (w) Iker Hernaez
-
Method Summary
Modifier and TypeMethodDescription<T> TdefaultValue(@NotNull Class<T> type, @NotNull Object... params) Returns the default value for the specified type and parameter sources.<T> TnullableDefaultValue(@NotNull Class<T> type, @NotNull Object... params) Returns the default value for the specified type and parameter sources allowingnullvalues.<T> TnullableRandomValue(@NotNull Class<T> type, @NotNull Object... params) Returns a random value of the specified type and parameter sources.<T> TrandomValue(@NotNull Class<T> type, @NotNull Object... params) Returns a random value of the specified type and parameter sources.Methods inherited from interface dev.orne.test.rnd.Generator
asParameterizable, defaultValue, getPriority, nullableDefaultValue, nullableRandomValue, randomValue, supports
-
Method Details
-
defaultValue
Returns the default value for the specified type and parameter sources.- Type Parameters:
T- The requested value type.- Parameters:
type- The requested value type.params- The parameter sources to extract the parameters from- Returns:
- The default value for the specified type.
- Throws:
IllegalArgumentException- If the specified type is not supported.
-
nullableDefaultValue
Returns the default value for the specified type and parameter sources allowingnullvalues.This method should return
nullexcept for native types when noNotNullconstraint is present.- Type Parameters:
T- The requested value type.- Parameters:
type- The requested value type.params- The parameter sources to extract the parameters from- Returns:
- The nullable default value for the specified type.
- Throws:
IllegalArgumentException- If the specified type is not supported.
-
randomValue
Returns a random value of the specified type and parameter sources.- Type Parameters:
T- The requested value type.- Parameters:
type- The requested value type.params- The parameter sources to extract the parameters from- Returns:
- A random value for the specified type.
- Throws:
IllegalArgumentException- If the specified type is not supported.
-
nullableRandomValue
Returns a random value of the specified type and parameter sources.The returned value has a probability of be
nullexcept for native types when noNotNullconstraint is present. If notnullbehaves asrandomValue().- Type Parameters:
T- The requested value type.- Parameters:
type- The requested value type.params- The parameter sources to extract the parameters from- Returns:
- A random nullable value for the specified type.
- Throws:
IllegalArgumentException- If the specified type is not supported.- See Also:
-