Package net.jqwik.api
Interface ArbitrarySupplier<T>
-
- All Superinterfaces:
java.util.function.Supplier<Arbitrary<T>>
- All Known Implementing Classes:
ArbitrarySupplier.NONE
@API(status=EXPERIMENTAL, since="1.6.3") public interface ArbitrarySupplier<T> extends java.util.function.Supplier<Arbitrary<T>>
Implementations of this class are used to provide single arbitraries forForAll
parameters and parameter types annotated withFrom
. UseForAll.supplier()
orFrom.supplier()
attributes to specify the actual implementation class.Either
supplyFor(TypeUsage)
orget()
must be overridden. But not both.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ArbitrarySupplier.NONE
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default Arbitrary<T>
get()
Override this method if generating the arbitrary is straightforward.default Arbitrary<T>
supplyFor(TypeUsage targetType)
Override this method if you need more information about the target type, e.g. annotations or type parameters.
-
-
-
Method Detail
-
supplyFor
default Arbitrary<T> supplyFor(TypeUsage targetType)
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
default Arbitrary<T> 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.- Specified by:
get
in interfacejava.util.function.Supplier<T>
- Returns:
- A new arbitrary instance
-
-