PresentProvider

A Provider that is always present, that is, one that always has a value.

Querying the value of this provider never fails: get always returns the value, getOrNull never returns null and isPresent always returns true. Only the presence of the value is guaranteed; the value itself is not necessarily constant.

Note: This interface is not intended for implementation by build script or plugin authors. A provider that is always present can be created via present.

Since

9.9.0

Parameters

<T>

Type of value represented by the provider

Functions

Link copied to clipboard
abstract fun filter(spec: Spec<in T>): Provider<T>
Returns a new Provider with the value of this provider if the passed spec is satisfied and no value otherwise.
Link copied to clipboard
abstract fun <S> flatMap(transformer: Transformer<out @Nullable Provider<out S>, in T>): Provider<S>
Returns a new Provider from the value of this provider transformed using the given function.
Link copied to clipboard
abstract fun get(): T
Returns the value of this provider.
Link copied to clipboard
abstract fun getOrElse(defaultValue: T): T
Returns the value of this provider.
Link copied to clipboard
abstract fun getOrNull(): T
Returns the value of this provider.
Link copied to clipboard
abstract fun isPresent(): Boolean
Returns whether the provider has a value present.
Link copied to clipboard
abstract fun <S> map(transformer: Transformer<out @Nullable S, in T>): Provider<S>
Returns a new Provider whose value is the value of this provider transformed using the given function.
Link copied to clipboard
abstract fun orElse(value: T): PresentProvider<T>
Returns this provider, as the value is always present and the given default value can never be used.
abstract fun orElse(provider: Provider<out T>): PresentProvider<T>
Returns this provider, as the value is always present and the given default provider can never be used.
Link copied to clipboard
abstract fun <U, R> zip(right: Provider<U>, combiner: BiFunction<in T, in U, out @Nullable R>): Provider<R>
Returns a provider which value will be computed by combining this provider value with another provider value using the supplied combiner function.