Package net.jqwik.api
Interface ArbitrarySupplier<T>
- All Known Implementing Classes:
ArbitrarySupplier.NONE
@API(status=MAINTAINED,
since="1.7.0")
public interface ArbitrarySupplier<T>
extends Supplier<Arbitrary<T>>
Implementations of this class are used to provide single arbitraries for
ForAll parameters and parameter types annotated with From.
Use ForAll.supplier() or From.supplier() attributes to specify
the actual implementation class.
Either supplyFor(TypeUsage) or get() must be overridden.
But not both.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionget()Override this method if generating the arbitrary is straightforward.Override this method if you need more information about the target type, e.g. annotations or type parameters.
-
Method Details
-
supplyFor
Override this method if you need more information about the target type, e.g. annotations or type parameters.This method takes precedence if both
supplyFor(TypeUsage)andget()are overridden.- Parameters:
targetType- Specifies the type to generate.- Returns:
- A new arbitrary instance
-
get
Override this method if generating the arbitrary is straightforward. This is probably the standard usage.Mind that
supplyFor(TypeUsage)takes precedence if bothsupplyFor(TypeUsage)andget()are overridden.
-