api / org.gradle.api.provider / PropertyState

PropertyState

@Incubating interface PropertyState<T : Any> : Property<T>

A Provider representation for capturing the state of a property. The value can be provided by using the method #set(Object) or #set(Provider).

Note: This interface is not intended for implementation by build script or plugin authors. An instance of this class can be created through the factory methods org.gradle.api.Project#property(java.lang.Class) or org.gradle.api.provider.ProviderFactory#property(java.lang.Class).

Parameters

- Type of value represented by property state

Since
4.0

Inherited Functions

set

abstract fun set(value: T): Unit

Sets the value of the property the given value.

This method can also be used to clear the value of the property, by passing null as the value.

abstract fun set(provider: Provider<out T>): Unit

Sets the property to have the same value of the given provider. This property will track the value of the provider and query its value each time the value of the property is queried. When the provider has no value, this property will also have no value.

Extension Functions

getValue

operator fun <T> PropertyState<T>.getValue(receiver: Any?, property: KProperty<*>): T

Property delegate for PropertyState instances.

setValue

operator fun <T> PropertyState<T>.setValue(receiver: Any?, property: KProperty<*>, value: T): Unit

Property delegate for PropertyState instances.

Inheritors

DirectoryVar

interface DirectoryVar : DirectoryProperty, PropertyState<Directory>

Represents some configurable directory location, whose value is mutable and is not necessarily currently known until later.

Note: This interface is not intended for implementation by build script or plugin authors. An instance of this class can be created using the ProjectLayout#newDirectoryVar() method.

RegularFileVar

interface RegularFileVar : RegularFileProperty, PropertyState<RegularFile>

Represents some configurable regular file location, whose value is mutable and not necessarily currently known until later.

Note: This interface is not intended for implementation by build script or plugin authors. An instance of this class can be created using the ProjectLayout#newFileVar() method.