convention

abstract fun convention(@Nullable value: T): Property<T>(source)

Specifies the value to use as the convention (default value) for this property. If the convention is set and no explicit value or value provider has been specified, then the convention will be returned as the value of the property (when queried).

This method can be used to specify that the property does not have a default value, by passing it null.

Return

this

Since

5.1

Parameters

value

The convention value, or null if the property should have no default value.


abstract fun convention(provider: Provider<out T>): Property<T>(source)

Specifies the provider to be used to query the convention (default value) for this property. If a convention provider has been set and no explicit value or value provider has been specified, then the convention provider's value will be returned as the value of the property (when queried).

The property's convention tracks the convention provider. Whenever the convention's actual value is needed, the convention provider will be queried anew.

This method can't be used to specify that a property does not have a default value. Passing in a null provider will result in an IllegalArgumentException being thrown. When the provider doesn't have a value, then the property will behave as if it wouldn't have a convention specified.

Return

this

Since

5.1

Parameters

provider

The provider of the property's convention value, can't be null.