Interface TargetedGenerator<T>
- Type Parameters:
T- The type of the target
- All Known Implementing Classes:
AbstractTargetedGenerator,ConstructorParameterTypeGenerator,MethodParameterTypeGenerator,MethodReturnTypeGenerator,ParameterTypeGenerator,PropertyTypeGenerator
- Since:
- 0.1
- Version:
- 1.0, 2022-11
- Author:
- (w) Iker Hernaez
-
Method Summary
Modifier and TypeMethodDescriptiondefaultValue(@NotNull Class<?>... groups) Returns the default value of the supported type.@NotNull Object[]getParameterSources(@NotNull Class<?>... groups) Returns the generation parameter sources to be used.nullableDefaultValue(@NotNull Class<?>... groups) Returns the default value for the specified type allowingnullvalues.nullableRandomValue(@NotNull Class<?>... groups) Returns a random value of the specified type.randomValue(@NotNull Class<?>... groups) Returns a random value of the supported type.
-
Method Details
-
getParameterSources
Returns the generation parameter sources to be used.The specified validation groups will be used to retrieve the constraints to use as sources.
- Parameters:
groups- The validation groups.- Returns:
- The generation parameter sources.
-
defaultValue
Returns the default value of the supported type.If the generator for the type of the target is a
ParameterizableGeneratorextracts the parameters from the constraints of the target when applying the specified validation groups.- Parameters:
groups- The validation groups to use when extracting the constraints of the target.- Returns:
- The default value.
-
nullableDefaultValue
Returns the default value for the specified type allowingnullvalues.If the generator for the type of the target is a
ParameterizableGeneratorextracts the parameters from the constraints of the target when applying the specified validation groups.This method should return
nullexcept for native types or targets annotated withNotNull.- Parameters:
groups- The validation groups to use when extracting the constraints of the target.- Returns:
- The nullable default value for the specified type.
-
randomValue
Returns a random value of the supported type.If the generator for the type of the target is a
ParameterizableGeneratorextracts the parameters from the constraints of the target when applying the specified validation groups.- Parameters:
groups- The validation groups to use when extracting the constraints of the target- Returns:
- A random value.
-
nullableRandomValue
Returns a random value of the specified type.If the generator for the type of the target is a
ParameterizableGeneratorextracts the parameters from the constraints of the target when applying the specified validation groups.The returned value has a probability of be
nullexcept for native types or targets annotated withNotNull. If notnullbehaves asrandomValue().- Parameters:
groups- The validation groups to use when extracting the constraints of the target.- Returns:
- A random nullable value.
- See Also:
-