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 ClassesModifier and TypeInterfaceDescriptionstatic final class -
Method Summary
Modifier and TypeMethodDescriptionintattempts()default voidSignals part of an attempt to generate a value.<T> GenerationStatussetValue(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.intsize()<T> Optional<T>valueOf(GenerationStatus.Key<T> key) 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
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 valuevalue- the associated value- Returns:
- self, so that calls to this method can be chained
-
valueOf
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
-