Package net.jqwik.api.arbitraries
Interface TypeArbitrary<T>
-
- All Superinterfaces:
Arbitrary<T>
@API(status=MAINTAINED, since="1.2") public interface TypeArbitrary<T> extends Arbitrary<T>
Fluent interface to configure arbitraries that try to generate instances of a given typeT
from the type's available constructors and factory methods.When constructors and factory methods have parameters those parameters will be resolved by searching for matching registered arbitrary providers. The searching is performed either globally or in the property method's specified domain contexts.
- See Also:
Domain
,DomainContext
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.jqwik.api.Arbitrary
Arbitrary.ArbitraryFacade
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TypeArbitrary<T>
use(java.lang.reflect.Executable creator)
Add another creator (function or constructor) to be used for generating values of typeT
TypeArbitrary<T>
useAllConstructors()
Add all constructors (public, private or package scope) of classT
to be used for generating values of typeT
TypeArbitrary<T>
useAllFactoryMethods()
Add all factory methods (static methods with return typeT
) of classT
to be used for generating values of typeT
TypeArbitrary<T>
useConstructors(java.util.function.Predicate<? super java.lang.reflect.Constructor<?>> filter)
Add all constructors (public, private or package scope) of classT
to be used for generating values of typeT
TypeArbitrary<T>
useFactoryMethods(java.util.function.Predicate<java.lang.reflect.Method> filter)
Add all factory methods (static methods with return typeT
) of classT
to be used for generating values of typeT
TypeArbitrary<T>
usePublicConstructors()
Add public constructors of classT
to be used for generating values of typeT
TypeArbitrary<T>
usePublicFactoryMethods()
Add public factory methods (static methods with return typeT
) of classT
to be used for generating values of typeT
-
Methods inherited from interface net.jqwik.api.Arbitrary
allValues, array, asGeneric, collect, dontShrink, edgeCases, exhaustive, exhaustive, filter, fixGenSize, flatMap, forEachValue, generator, ignoreException, injectDuplicates, injectNull, isUnique, iterator, list, map, optional, sample, sampleStream, set, stream, tuple1, tuple2, tuple3, tuple4, tuple5, unique
-
-
-
-
Method Detail
-
use
TypeArbitrary<T> use(java.lang.reflect.Executable creator)
Add another creator (function or constructor) to be used for generating values of typeT
- Parameters:
creator
- The static function or constructor- Returns:
- the same arbitrary instance
-
usePublicConstructors
TypeArbitrary<T> usePublicConstructors()
Add public constructors of classT
to be used for generating values of typeT
- Returns:
- the same arbitrary instance
-
useAllConstructors
TypeArbitrary<T> useAllConstructors()
Add all constructors (public, private or package scope) of classT
to be used for generating values of typeT
- Returns:
- the same arbitrary instance
-
useConstructors
TypeArbitrary<T> useConstructors(java.util.function.Predicate<? super java.lang.reflect.Constructor<?>> filter)
Add all constructors (public, private or package scope) of classT
to be used for generating values of typeT
- Parameters:
filter
- Predicate to add only those constructors for which the predicate returns true- Returns:
- the same arbitrary instance
-
usePublicFactoryMethods
TypeArbitrary<T> usePublicFactoryMethods()
Add public factory methods (static methods with return typeT
) of classT
to be used for generating values of typeT
- Returns:
- the same arbitrary instance
-
useAllFactoryMethods
TypeArbitrary<T> useAllFactoryMethods()
Add all factory methods (static methods with return typeT
) of classT
to be used for generating values of typeT
- Returns:
- the same arbitrary instance
-
useFactoryMethods
TypeArbitrary<T> useFactoryMethods(java.util.function.Predicate<java.lang.reflect.Method> filter)
Add all factory methods (static methods with return typeT
) of classT
to be used for generating values of typeT
- Parameters:
filter
- Predicate to add only those factory methods for which the predicate returns true- Returns:
- the same arbitrary instance
-
-