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 |
|---|---|---|
Provider<String> |
environmentVariable(String variableName) |
Creates a
Provider whose value is fetched from the environment variable with the given name. |
Provider<String> |
environmentVariable(Provider<String> variableName) |
Creates a
Provider whose value is fetched from the environment variable with the given name. |
FileContents |
fileContents(RegularFile file) |
Allows lazy access to the contents of the given file.
|
FileContents |
fileContents(Provider<RegularFile> file) |
Allows lazy access to the contents of the given file.
|
<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> environmentVariable(String variableName)
Provider whose value is fetched from the environment variable with the given name.variableName - The name of the environment variable.@Incubating Provider<String> environmentVariable(Provider<String> variableName)
Provider whose value is fetched from the environment variable with the given name.variableName - The provider for the name of the environment variable; when the given provider has no value, the returned provider has no 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 FileContents fileContents(RegularFile file)
file - the file whose contents to read.FileContents.getAsText(),
FileContents.getAsBytes()@Incubating FileContents fileContents(Provider<RegularFile> file)
file - provider of the file whose contents to read.FileContents.getAsText(),
FileContents.getAsBytes()@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 ValueSourceconfiguration - action to configure the parameters to the given ValueSource