Package org.gradle.api.provider
Interface ProviderFactory
-
@Incubating public interface ProviderFactory
A factory for creating instances ofProvider.An instance of the factory can be injected into a task or plugin by annotating a public constructor or method with
javax.inject.Inject.public class MyTask extends DefaultTask { // injection into a constructor @javax.inject.Inject public MyTask(ProviderFactory providerFactory) { } // injection into a method @javax.inject.Inject public ProviderFactory getProviderFactory() { throw new UnsupportedOperationException(); } }An instance of the factory is also available using
Project.getProviders()- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Provider<T>provider(Callable<? extends T> value)
-
-
-
Method Detail
-
provider
<T> Provider<T> provider(Callable<? extends T> value)
Creates aProviderwhose value is calculated using the givenCallable.The provider is live and will call the
Callableeach time its value is queried. TheCallablemay returnnull, in which case the provider is considered to have no value.- Parameters:
value- Thejava.util.concurrent.Callableuse to calculate the value.- Returns:
- The provider. Never returns null.
-
-