# Property

@ManagedType
@SupportsKotlinAssignmentOverloading
interface Property<T> : Provider<T> , HasConfigurableValue, SupportsConvention(source)

A container object that represents a configurable value of a specific type. A Property is also a Provider and can be used in the same way as a Provider. A property's value can be accessed using the methods of Provider such as get(). The value can be modified by using the methods set and set, or their fluid API counterparts value and value.

A property may represent a task output. Such a property carries information about the task producing its value. When this property is attached to an input of another task, Gradle will automatically determine the task dependencies based on this connection.

There are also several specialized subtypes of this interface that can be created using various other factory methods.

Instances of this interface are not thread-safe for reading and writing. It is not safe to share the same Property instance between different projects.

Note: This interface is not intended for implementation by build script or plugin authors.

#### Since

4.3

#### Parameters

<T>

Type of value represented by the property

#### See also

ManagedType

Create an instance of this as a managed property (preferred).

ObjectFactory

Create an instance of this manually.

#### Inheritors

FileSystemLocationProperty

## Functions

assign
Link copied to clipboard
fun <T : Any> Property<T>.assign(value: T?)

Assign value: T to a property with assign operator

fun <T : Any> Property<T>.assign(value: Provider<out T>)

Assign value: Provider to a property with assign operator

convention
Link copied to clipboard
abstract fun convention(@Nullable value: @Nullable T): Property<T>
Specifies the value to use as the convention (default value) for this property.
abstract fun convention(provider: Provider<out T>): Property<T>
Specifies the provider to be used to query the convention (default value) for this property.
disallowChanges
Link copied to clipboard
abstract fun disallowChanges()
disallowUnsafeRead
Link copied to clipboard
abstract fun disallowUnsafeRead()
filter
Link copied to clipboard
abstract fun filter(spec: Spec<in T>): Provider<T>
finalizeValue
Link copied to clipboard
abstract fun finalizeValue()
Disallows further changes to the value of this property.
finalizeValueOnRead
Link copied to clipboard
abstract fun finalizeValueOnRead()
flatMap
Link copied to clipboard
abstract fun <S> flatMap(transformer: Transformer<out @Nullable Provider<out S>, in T>): Provider<S>
get
Link copied to clipboard
abstract fun get(): T
getOrElse
Link copied to clipboard
abstract fun getOrElse(defaultValue: T): T
getOrNull
Link copied to clipboard
abstract fun getOrNull(): @Nullable T
getValue
Link copied to clipboard
operator fun <T : Any> Property<T>.getValue(receiver: Any?, property: KProperty<*>): T

Property delegate for Property instances.

isPresent
Link copied to clipboard
abstract fun isPresent(): Boolean
map
Link copied to clipboard
abstract fun <S> map(transformer: Transformer<out @Nullable S, in T>): Provider<S>
orElse
Link copied to clipboard
abstract fun orElse(value: T): Provider<T>
set
Link copied to clipboard
abstract fun set(@Nullable value: @Nullable T)
Sets the value of the property to the given value, replacing whatever value the property already had.
abstract fun set(provider: Provider<out T>)
Sets the property to have the same value as the given provider, replacing whatever value the property already had.
setValue
Link copied to clipboard
operator fun <T : Any> Property<T>.setValue(receiver: Any?, property: KProperty<*>, value: T)

Property delegate for Property instances.

unset
Link copied to clipboard
abstract fun unset(): Property<T>
This is similar to calling value with a `null` argument.
unsetConvention
Link copied to clipboard
abstract fun unsetConvention(): Property<T>
This is similar to calling convention with a `null` argument.
value
Link copied to clipboard
abstract fun value(@Nullable value: @Nullable T): Property<T>
Sets the value of the property to the given value, replacing whatever value the property already had.
abstract fun value(provider: Provider<out T>): Property<T>
Sets the property to have the same value as the given provider, replacing whatever value the property already had.
zip
Link copied to clipboard
abstract fun <U, R> zip(right: Provider<U>, combiner: BiFunction<in T, in U, out @Nullable R>): Provider<R>