public interface ProviderFactory
Provider
.
An instance of the factory can be injected into a task, plugin or other object by annotating a public constructor or property getter method with javax.inject.Inject
.
It is also available via Project.getProviders()
.
Modifier and Type | Method | Description |
---|---|---|
<T,P extends ValueSourceParameters> |
of(Class<? extends ValueSource<T,P>> valueSourceType,
Action<? super ValueSourceSpec<P>> configuration) |
Creates a
Provider whose value is obtained from the given ValueSource . |
<T> Provider<T> |
provider(Callable<? extends T> value) |
|
Provider<String> |
systemProperty(String propertyName) |
Creates a
Provider whose value is fetched from system properties using the given property name. |
Provider<String> |
systemProperty(Provider<String> propertyName) |
Creates a
Provider whose value is fetched from system properties using the given property name. |
<T> Provider<T> provider(Callable<? extends T> value)
Provider
whose value is calculated using the given Callable
.
The provider is live and will call the Callable
each time its value is queried. The Callable
may return null
, in which case the provider is considered to have no value.
value
- The java.util.concurrent.Callable
use to calculate the value.@Incubating Provider<String> systemProperty(String propertyName)
Provider
whose value is fetched from system properties using the given property name.propertyName
- the name of the system property@Incubating Provider<String> systemProperty(Provider<String> propertyName)
Provider
whose value is fetched from system properties using the given property name.propertyName
- the name of the system property@Incubating <T,P extends ValueSourceParameters> Provider<T> of(Class<? extends ValueSource<T,P>> valueSourceType, Action<? super ValueSourceSpec<P>> configuration)
Provider
whose value is obtained from the given ValueSource
.valueSourceType
- the type of the ValueSource
configuration
- action to configure the parameters to the given ValueSource