Package org.gradle.api.provider
Interface ListProperty<T>
-
- Type Parameters:
T
- the type of elements.
- All Superinterfaces:
HasConfigurableValue
,HasMultipleValues<T>
,Provider<java.util.List<T>>
,SupportsConvention
public interface ListProperty<T> extends Provider<java.util.List<T>>, HasMultipleValues<T>
Represents a property whose type is aList
of elements of typeListProperty
.You can create a
ListProperty
instance using factory methodObjectFactory.listProperty(Class)
.Note: This interface is not intended for implementation by build script or plugin authors.
- Since:
- 4.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ListProperty<T>
convention(java.lang.Iterable<? extends T> elements)
Specifies the value to use as the convention for this property.ListProperty<T>
convention(Provider<? extends java.lang.Iterable<? extends T>> provider)
Specifies the provider of the value to use as the convention for this property.ListProperty<T>
empty()
Sets the value of this property to an empty collection, and replaces any existing value.ListProperty<T>
unset()
Unsets this object's explicit value, allowing the convention to be selected when evaluating this object's value.ListProperty<T>
unsetConvention()
Unsets this object's convention value.ListProperty<T>
value(java.lang.Iterable<? extends T> elements)
Sets the value of the property to the elements of the given iterable, and replaces any existing value.ListProperty<T>
value(Provider<? extends java.lang.Iterable<? extends T>> provider)
Sets the property to have the same value of the given provider, and replaces any existing value.-
Methods inherited from interface org.gradle.api.provider.HasConfigurableValue
disallowChanges, disallowUnsafeRead, finalizeValueOnRead
-
Methods inherited from interface org.gradle.api.provider.HasMultipleValues
add, add, addAll, addAll, addAll, finalizeValue, set, set
-
-
-
-
Method Detail
-
empty
ListProperty<T> empty()
Sets the value of this property to an empty collection, and replaces any existing value.- Specified by:
empty
in interfaceHasMultipleValues<T>
- Returns:
- this property.
-
value
ListProperty<T> value(@Nullable java.lang.Iterable<? extends T> elements)
Sets the value of the property to the elements of the given iterable, and replaces any existing value. This property will query the elements of the iterable each time the value of this property is queried.This is the same as
HasMultipleValues.set(Iterable)
but returns this property to allow method chaining.- Specified by:
value
in interfaceHasMultipleValues<T>
- Parameters:
elements
- The elements, can be null.- Returns:
- this
-
value
ListProperty<T> value(Provider<? extends java.lang.Iterable<? extends T>> provider)
Sets the property to have the same value of the given provider, and replaces any existing value. This property will track the value of the provider and query its value each time the value of this property is queried. When the provider has no value, this property will also have no value.This is the same as
HasMultipleValues.set(Provider)
but returns this property to allow method chaining.- Specified by:
value
in interfaceHasMultipleValues<T>
- Parameters:
provider
- Provider of the elements.- Returns:
- this
-
convention
ListProperty<T> convention(@Nullable java.lang.Iterable<? extends T> elements)
Specifies the value to use as the convention for this property. The convention is used when no value has been set for this property.- Specified by:
convention
in interfaceHasMultipleValues<T>
- Parameters:
elements
- The elements, ornull
when the convention is that the property has no value.- Returns:
- this
-
convention
ListProperty<T> convention(Provider<? extends java.lang.Iterable<? extends T>> provider)
Specifies the provider of the value to use as the convention for this property. The convention is used when no value has been set for this property.- Specified by:
convention
in interfaceHasMultipleValues<T>
- Parameters:
provider
- The provider of the elements- Returns:
- this
-
unset
ListProperty<T> unset()
Unsets this object's explicit value, allowing the convention to be selected when evaluating this object's value.This is similar to calling
value(Iterable)
with anull
argument.- Specified by:
unset
in interfaceSupportsConvention
-
unsetConvention
ListProperty<T> unsetConvention()
Unsets this object's convention value.This is similar to calling
convention(Iterable)
with anull
argument.- Specified by:
unsetConvention
in interfaceSupportsConvention
-
-