All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.jqwik.api.configurators.SelfConfiguringArbitrary Maven / Gradle / Ivy

There is a newer version: 1.9.1
Show newest version
package net.jqwik.api.configurators;

import org.apiguardian.api.*;

import net.jqwik.api.*;
import net.jqwik.api.providers.*;

import org.jspecify.annotations.*;

import static org.apiguardian.api.API.Status.*;

/**
 * An {@linkplain Arbitrary} implementation can also implement this interface if it wants
 * to take over its own configuration which is usually being done by registered instances
 * of {@linkplain ArbitraryConfigurator}.
 *
 * 

* There are a few implementors within jqwik's own codebase: *

* */ @API(status = MAINTAINED, since = "1.0") public interface SelfConfiguringArbitrary { /** * If an arbitrary is self configuring use it, otherwise use default configurator */ @SuppressWarnings("unchecked") @API(status = INTERNAL) static Arbitrary configure(Arbitrary self, ArbitraryConfigurator configurator, TypeUsage targetType) { if (self instanceof SelfConfiguringArbitrary) { return ((SelfConfiguringArbitrary) self).configure(configurator, targetType); } else { return configurator.configure(self, targetType); } } /** * Do all configuration yourself or delegate to {@link ArbitraryConfigurator#configure(Arbitrary, TypeUsage)} * of the {@code configurator} that's being handed in. * * @param configurator the configurator to use * @param targetType the target type of the arbitrary * @return the arbitrary instance or a new derived one */ Arbitrary configure(ArbitraryConfigurator configurator, TypeUsage targetType); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy