Package net.jqwik.api.lifecycle
Class PerProperty.PerPropertyHook
java.lang.Object
net.jqwik.api.lifecycle.PerProperty.PerPropertyHook
- All Implemented Interfaces:
AroundPropertyHook
,LifecycleHook
,ResolveParameterHook
- Enclosing class:
- PerProperty
public static class PerProperty.PerPropertyHook
extends Object
implements AroundPropertyHook, ResolveParameterHook
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.jqwik.api.lifecycle.ResolveParameterHook
ResolveParameterHook.ParameterSupplier
-
Field Summary
Fields inherited from interface net.jqwik.api.lifecycle.AroundPropertyHook
BASE
Fields inherited from interface net.jqwik.api.lifecycle.ResolveParameterHook
DO_NOT_RESOLVE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaroundProperty
(PropertyLifecycleContext context, PropertyExecutor property) When you wrap a property you can do stuff before and/or after its execution.int
The higher the value, the closer to the actual property method.resolve
(ParameterResolutionContext parameterContext, LifecycleContext lifecycleContext) This method will be called only once per property, whereas the returned supplier's get method is usually invoked for each try - and potentially more often during shrinking or when resolving parameters in before/after methods.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.jqwik.api.lifecycle.AroundPropertyHook
compareTo
Methods inherited from interface net.jqwik.api.lifecycle.LifecycleHook
appliesTo, propagateTo
-
Constructor Details
-
PerPropertyHook
public PerPropertyHook()
-
-
Method Details
-
aroundProperty
public PropertyExecutionResult aroundProperty(PropertyLifecycleContext context, PropertyExecutor property) Description copied from interface:AroundPropertyHook
When you wrap a property you can do stuff before and/or after its execution. All implementors should invoke the property withproperty.execute()
and either return the result of this call or map it to another result.- Specified by:
aroundProperty
in interfaceAroundPropertyHook
- Parameters:
context
- The property's context objectproperty
- An executor to run the property- Returns:
- The result of running the property
-
aroundPropertyProximity
public int aroundPropertyProximity()Description copied from interface:AroundPropertyHook
The higher the value, the closer to the actual property method. Default value is 0.Values greater than -10 will make it run "inside" annotated lifecycle methods (BeforeProperty and AfterProperty).
- Specified by:
aroundPropertyProximity
in interfaceAroundPropertyHook
- Returns:
- an integer value
-
resolve
public Optional<ResolveParameterHook.ParameterSupplier> resolve(ParameterResolutionContext parameterContext, LifecycleContext lifecycleContext) Description copied from interface:ResolveParameterHook
This method will be called only once per property, whereas the returned supplier's get method is usually invoked for each try - and potentially more often during shrinking or when resolving parameters in before/after methods. The returned supplier should always return an equivalent object, i.e. an object that behaves the same when used in the same way.- Specified by:
resolve
in interfaceResolveParameterHook
- Parameters:
parameterContext
- Contains information of parameter to resolvelifecycleContext
- Can be of type ContainerLifecycleContext or PropertyLifecycleContext- Returns:
- supplier instance wrapped in Optional or Optional.empty() if it cannot be resolved
-