Interface GenerationStatus

All Known Implementing Classes:
AbstractGenerationStatus, PropertyParameterGenerationContext, SimpleGenerationStatus

public interface GenerationStatus
Generators are fed instances of this interface on each generation so that, if they choose, they can use these instances to influence the results of a generation for a particular property parameter.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Type-safe keys for setValue and valueOf.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    default void
    Signals part of an attempt to generate a value.
    setValue(GenerationStatus.Key<T> key, T value)
    Associates the given value with the given key for the duration of the generation of a value for a property parameter, or until overwritten.
    int
     
    <T> Optional<T>
    Retrieves the value associated with the given key.
  • Method Details

    • size

      int size()
      Returns:
      an arbitrary "size" parameter; this value (probabilistically) increases for every successful generation
    • attempts

      int attempts()
      Returns:
      how many attempts have been made to generate a value for a property parameter
    • semiAttempt

      default void semiAttempt()

      Signals part of an attempt to generate a value.

      Mostly for use by junit-quickcheck itself; generators can call this to convince the framework that it's doing work to generate a complex value, but doing so is not strictly necessary.

    • setValue

      <T> GenerationStatus setValue(GenerationStatus.Key<T> key, T value)
      Associates the given value with the given key for the duration of the generation of a value for a property parameter, or until overwritten.
      Type Parameters:
      T - type of the value
      Parameters:
      key - a key to associate with a value
      value - the associated value
      Returns:
      self, so that calls to this method can be chained
    • valueOf

      <T> Optional<T> valueOf(GenerationStatus.Key<T> key)
      Retrieves the value associated with the given key.
      Type Parameters:
      T - type of the value associated with the key
      Parameters:
      key - key to look up
      Returns:
      the (optional) associated value