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> T
defaultValue
(@NotNull Class<T> type, @NotNull Object... params) Returns the default value for the specified type and parameter sources.<T> T
nullableDefaultValue
(@NotNull Class<T> type, @NotNull Object... params) Returns the default value for the specified type and parameter sources allowingnull
values.<T> T
nullableRandomValue
(@NotNull Class<T> type, @NotNull Object... params) Returns a random value of the specified type and parameter sources.<T> T
randomValue
(@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 allowingnull
values.This method should return
null
except for native types when noNotNull
constraint 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
null
except for native types when noNotNull
constraint is present. If notnull
behaves 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:
-