@API(status=MAINTAINED, since="1.7.0") public interface ArbitrarySupplier<T> extends java.util.function.Supplier<Arbitrary<T>>
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.
Modifier and Type | Interface and Description |
---|---|
static class |
ArbitrarySupplier.NONE |
Modifier and Type | Method and Description |
---|---|
default @Nullable Arbitrary<T> |
get()
Override this method if generating the arbitrary is straightforward.
|
default @Nullable Arbitrary<T> |
supplyFor(TypeUsage targetType)
Override this method if you need more information about the target type,
e.g. annotations or type parameters.
|
default @Nullable Arbitrary<T> supplyFor(TypeUsage targetType)
This method takes precedence if both supplyFor(TypeUsage)
and get()
are overridden.
targetType
- Specifies the type to generate.default @Nullable Arbitrary<T> get()
Mind that supplyFor(TypeUsage)
takes precedence if both
supplyFor(TypeUsage)
and get()
are overridden.