public interface ProviderTools
Tools to safely deal with providers across all Gradle versions 4.0+.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public boolean |
atConfigurationTime()Value that can be read safely at configuration time |
|
public Provider<String> |
environmentVariable(Object name)Creates a provider to an environmental variable. |
|
public Provider<String> |
environmentVariable(Object name, boolean configurationTimeSafety)Creates a provider to an environmental variable. |
<S, T> |
public Provider<S> |
flatMap(Provider<T> provider, Transformer<? extends Provider<? extends S>, ? super T> transformer)Allow flatMap functionality for providers even before Gradle 5.0. |
|
public Provider<String> |
gradleProperty(Object name)Creates a provider to a project property. |
|
public Provider<String> |
gradleProperty(Object name, boolean configurationTimeSafety)Creates a provider to a project property. |
<T> |
public ListProperty<T> |
listProperty(Class<T> valueType)Creates a ListProperty instance. |
<T> |
public ListProperty<T> |
listProperty(Class<T> valueType, java.util.Iterator<? extends T> defaultValues)Creates a ListProperty instance and initialises it from the supplied default values |
<K, V> |
public MapProperty<K, V> |
mapProperty(Class<K> keyType, Class<V> valueType)Creates a MapProperty instance |
<T> |
public T |
newInstance(Class<? extends T> type, Object parameters)Shortcut for creating a new instance of an object. |
<T> |
public Provider<T> |
orElse(Provider<T> provider, T value)Allow orElse functionality prior to Gradle 5.6. |
<T> |
public Provider<T> |
orElse(Provider<T> provider, Provider<? extends T> elseProvider)Allow orElse functionality prior to Gradle 5.6. |
<T> |
public Property<T> |
property(Class<T> valueType)Creates a Property instance |
<T> |
public Property<T> |
property(Class<T> valueType, Provider<T> defaultValue)Creates a Property instance with a default value |
<T> |
public Provider<T> |
provider(java.util.concurrent.Callable<? extends T> value)Convenience interface for creating a provider. |
|
public Provider<String> |
resolveOrderly(Provider<String> one, Provider<String> two, Provider<String> three)Creates a provider that can resolve the three providers in order. |
|
public Provider<String> |
resolveProperty(Object name)Searches by Gradle property, then system property and finally by environment variable using the PropertyResolver convention. |
|
public Provider<String> |
resolveProperty(Object name, boolean configurationTimeSafety)Searches by Gradle property, then system property and finally by environment variable using the PropertyResolver convention. |
|
public Provider<String> |
resolveProperty(Object name, Object defaultValue)Searches by Gradle property, then system property and finally by environment variable using the PropertyResolver convention. |
|
public Provider<String> |
resolveProperty(Object name, Object defaultValue, boolean configurationTimeSafety)Searches by Gradle property, then system property and finally by environment variable using the PropertyResolver convention. |
<T> |
public java.util.Optional<T> |
resolveToOptional(Provider<T> providerValue)Resolves a provider and turn it into an java.util.Optional. |
|
public Provider<String> |
systemProperty(Object name)Creates a provider to a system property. |
|
public Provider<String> |
systemProperty(Object name, boolean configurationTimeSafety)Creates a provider to a system property. |
<T, U, V, R> |
public Provider<R> |
zip3(Provider<T> first, Provider<U> second, Provider<V> third, TriFunction<? super T, ? super U, ? super V, ? extends R> combiner)Zips three providers together. |
<T, U, V, W, R> |
public Provider<R> |
zip4(Provider<T> first, Provider<U> second, Provider<V> third, Provider<W> fourth, QuadFunction<? super T, ? super U, ? super V, ? super W, ? extends R> combiner)Zips four providers together. |
Value that can be read safely at configuration time
As from Gradle 8.0, methods take this as an input, will ignore this value as all providers that can be resolved at configuration-time are available.
Creates a provider to an environmental variable.
name - Anything convertible to a stringCreates a provider to an environmental variable.
name - Anything convertible to a stringconfigurationTimeSafety - Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored.Allow flatMap functionality for providers even before Gradle 5.0.
provider - Existing provider.transformer - Transform one provider to another.S - Return type of new provider.T - Return type of existing provider.Creates a provider to a project property.
name - Anything convertible to a stringCreates a provider to a project property.
name - Anything convertible to a stringconfigurationTimeSafety - Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored.Creates a ListProperty instance.
valueType - Class.T - Type of propertyCreates a ListProperty instance and initialises it from the supplied default values
valueType - Class.defaultValues - Defaults values for the list.T - Type of propertyCreates a MapProperty instance
keyType - Key typevalueType - Value typeK - Key typeV - Value typeShortcut for creating a new instance of an object.
Can be used with injected constructors to inject Gradle objects.
type - Type of object to createparameters - Zero or more parameters to pass to the object.T - Type ob object.Allow orElse functionality prior to Gradle 5.6.
Returns a Provider whose value is the value of this provider, if present, otherwise the given default value.
provider - Original provider.value - The default value to use when this provider has no value.T - Provider type.Allow orElse functionality prior to Gradle 5.6. Returns a Provider whose value is the value of this provider, if present, otherwise uses the value from the given provider, if present.
provider - Original providerelseProvider - The provider whose value should be used when this provider has no value.T - Provider typeCreates a Property instance
valueType - Class.T - Type of propertyCreates a Property instance with a default value
valueType - Class.defaultValue - A provider that can provider this value.T - Type of propertyConvenience interface for creating a provider.
Delegates to ProviderFactory.provider.
value - A function that will return a value or nullT - Type of value to be returned.Creates a provider that can resolve the three providers in order. If the first is not present, it will attempt to resolve the second and then the third.
one - First provider.two - Second provider.three - Third provider. Searches by Gradle property, then system property and finally by environment variable using the
PropertyResolver convention.
name - Anything convertible to a string Searches by Gradle property, then system property and finally by environment variable using the
PropertyResolver convention.
name - Anything convertible to a stringconfigurationTimeSafety - Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored. Searches by Gradle property, then system property and finally by environment variable using the
PropertyResolver convention.
name - Anything convertible to a stringdefaultValue - Default value to return if the property search order does not return any value.
Can be null. Anything convertible to a string. Searches by Gradle property, then system property and finally by environment variable using the
PropertyResolver convention.
name - Anything convertible to a stringdefaultValue - Default value to return if the property search order does not return any value.
Can be null. Anything convertible to a string.configurationTimeSafety - Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored.Resolves a provider and turn it into an java.util.Optional.
If the provider is empty, then an empty java.util.Optional is created.
providerValue - Provider to be resolved.T - Type of value.Creates a provider to a system property.
name - Anything convertible to a stringCreates a provider to a system property.
name - Anything convertible to a stringconfigurationTimeSafety - Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored.Zips three providers together.
first - First provider.second - Second provider.third - Third provider.combiner - Combiner function.T - Type of first provider.U - Type of second provider.V - Type of third provider.R - Type of returned provider.Zips four providers together.
first - First provider.second - Second provider.third - Third provider.fourth - Fourth provider.combiner - Combiner function.T - Type of first provider.U - Type of second provider.V - Type of third provider.W - Type of fourth provider.R - Type of returned provider.