api / org.gradle.language / BinaryProvider

BinaryProvider

@Incubating interface BinaryProvider<T : Any> : Provider<T>

Represents a binary that is created and configured as required.

Parameters

- The type of binary.

Since
4.5

Functions

configure

abstract fun configure(action: Action<in T>): Unit

Registers an action to execute to configure the binary. The action is executed only when the element is required.

whenFinalized

abstract fun whenFinalized(action: Action<in T>): Unit

Registers an action to execute when the binary has been configured. The action is executed only when the element is required.

Inherited Functions

get

abstract fun get(): T

Returns the value of this provider if it has a value present, otherwise throws java.lang.IllegalStateException.

getOrElse

abstract fun getOrElse(defaultValue: T): T

Returns the value of this provider if it has a value present. Returns the given default value if a value is not available.

getOrNull

abstract fun getOrNull(): T

Returns the value of this provider if it has a value present. Returns null a value is not available.

isPresent

abstract fun isPresent(): Boolean

Returns true if there is a value present, otherwise false.

map

abstract fun <S : Any> map(transformer: Transformer<out S, in T>): Provider<S>

Returns a new Provider whose value is the value of this provider transformed using the given function.

The new provider will be live, so that each time it is queried, it queries this provider and applies the transformation to the result. Whenever this provider has no value, the new provider will also have no value.

Note that the new provider may cache the result of the transformations and so there is no guarantee that the transformer is called on every query of the new provider. The new provider will apply the transformation lazily, and calculate the value for the new provider when queried.