@Incubating public interface ProviderFactory
Provider
.
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()
Modifier and Type | Method | Description |
---|---|---|
<T> Provider<T> |
provider(Callable<? extends T> value) |
<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.