api / org.gradle.api.provider / HasMultipleValues

HasMultipleValues

@Incubating interface HasMultipleValues<T : Any>

Represents a property whose value can be set using multiple elements of type T, such as a collection property.

Note: This interface is not intended for implementation by build script or plugin authors. You can use the factory methods on org.gradle.api.model.ObjectFactory to create instances of this interface.

Parameters

- the type of elements.

Since
4.5

Functions

add

abstract fun add(element: T): Unit

Adds an element to the property value.

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

Adds an element to the property value.

The given provider will be queried when the value of the property is queried. The property will have no value when the given provider has no value.

addAll

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

Adds zero or more elements to the property value.

The given provider will be queried when the value of the property is queried. The property will have no value when the given provider has no value.

set

abstract fun set(value: MutableIterable<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 MutableIterable<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.

Inheritors

ListProperty

interface ListProperty<T : Any> : Provider<MutableList<T>>, HasMultipleValues<T>

Represents a property whose type is a List of elements of type T.

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 method org.gradle.api.model.ObjectFactory#listProperty(Class).

SetProperty

interface SetProperty<T : Any> : Provider<MutableSet<T>>, HasMultipleValues<T>

Represents a property whose type is a Set of elements of type T. Retains iteration order.

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 method org.gradle.api.model.ObjectFactory#setProperty(Class).