Interface ParameterizableGenerator

All Superinterfaces:
Generator
All Known Subinterfaces:
TypedParameterizableGenerator<T>
All Known Implementing Classes:
AbstractParameterizableGenerator, AbstractTypedParameterizableGenerator, ListGenerator, MapGenerator, SetGenerator, StringGenerator

@API(status=EXPERIMENTAL, since="0.1") public interface ParameterizableGenerator extends Generator
Interface for random value generators with optional parameters.
Since:
0.1
Version:
1.0, 2022-11
Author:
(w) Iker Hernaez
  • Method Details

    • defaultValue

      @NotNull <T> T defaultValue(@NotNull @NotNull Class<T> type, @NotNull @NotNull Object... params)
      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

      <T> T nullableDefaultValue(@NotNull @NotNull Class<T> type, @NotNull @NotNull Object... params)
      Returns the default value for the specified type and parameter sources allowing null values.

      This method should return null except for native types when no NotNull 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

      @NotNull <T> T randomValue(@NotNull @NotNull Class<T> type, @NotNull @NotNull Object... params)
      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

      <T> T nullableRandomValue(@NotNull @NotNull Class<T> type, @NotNull @NotNull Object... params)
      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 no NotNull constraint is present. If not null behaves as randomValue().

      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: