Class Generators.MissingGenerator

java.lang.Object
dev.orne.test.rnd.Generators.MissingGenerator
All Implemented Interfaces:
Generator
Enclosing class:
Generators

@API(status=INTERNAL, since="0.1") public static final class Generators.MissingGenerator extends Object implements Generator
Cache value for missing generators for a value type.
Since:
Generators 1.0
Version:
1.0, 2022-10
Author:
(w) Iker Hernaez
  • Field Details

  • Method Details

    • supports

      public boolean supports(@NotNull @NotNull Class<?> type)
      Checks if values of the specified type can be generated by this instance.
      Specified by:
      supports in interface Generator
      Parameters:
      type - The type to check.
      Returns:
      If values of the specified type can be generated.
    • defaultValue

      @NotNull public <T> T defaultValue(@NotNull @NotNull Class<T> type)
      Returns the default value for the specified type.
      Specified by:
      defaultValue in interface Generator
      Type Parameters:
      T - The requested value type.
      Parameters:
      type - The requested value type.
      Returns:
      The default value for the specified type.
    • nullableDefaultValue

      public <T> T nullableDefaultValue(@NotNull @NotNull Class<T> type)
      Returns the default value for the specified type allowing null values.

      This method should return null except for native types.

      Specified by:
      nullableDefaultValue in interface Generator
      Type Parameters:
      T - The requested value type.
      Parameters:
      type - The requested value type.
      Returns:
      The nullable default value for the specified type.
    • randomValue

      @NotNull public <T> T randomValue(@NotNull @NotNull Class<T> type)
      Returns a random value of the specified type.
      Specified by:
      randomValue in interface Generator
      Type Parameters:
      T - The requested value type.
      Parameters:
      type - The requested value type.
      Returns:
      A random value for the specified type.
    • nullableRandomValue

      public <T> T nullableRandomValue(@NotNull @NotNull Class<T> type)
      Returns a random value of the specified type allowing null values.

      The returned value has a probability of be null except for native types. If not null behaves as randomValue().

      Specified by:
      nullableRandomValue in interface Generator
      Type Parameters:
      T - The requested value type.
      Parameters:
      type - The requested value type.
      Returns:
      A random nullable value for the specified type.
      See Also: