T
- the type of elements.HasConfigurableValue
ListProperty<T>
, SetProperty<T>
@SupportsKotlinAssignmentOverloading public interface HasMultipleValues<T> extends HasConfigurableValue
HasMultipleValues
, 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 ObjectFactory
to create various subtypes of this interface.
Modifier and Type | Method | Description |
---|---|---|
void |
add(Provider<? extends T> provider) |
Adds an element to the property value.
|
void |
add(T element) |
Adds an element to the property value.
|
void |
addAll(java.lang.Iterable<? extends T> elements) |
Adds zero or more elements to the property value.
|
void |
addAll(Provider<? extends java.lang.Iterable<? extends T>> provider) |
Adds zero or more elements to the property value.
|
void |
addAll(T... elements) |
Adds zero or more elements to the property value.
|
HasMultipleValues<T> |
convention(java.lang.Iterable<? extends T> elements) |
Specifies the value to use as the convention for this property.
|
HasMultipleValues<T> |
convention(Provider<? extends java.lang.Iterable<? extends T>> provider) |
Specifies the provider of the value to use as the convention for this property.
|
HasMultipleValues<T> |
empty() |
Sets the value of this property to an empty collection, and replaces any existing value.
|
void |
finalizeValue() |
Disallows further changes to the value of this property.
|
void |
set(java.lang.Iterable<? extends T> elements) |
Sets the value of the property to the elements of the given iterable, and replaces any existing value.
|
void |
set(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.
|
HasMultipleValues<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.
|
HasMultipleValues<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.
|
disallowChanges, disallowUnsafeRead, finalizeValueOnRead
void set(@Nullable java.lang.Iterable<? extends T> elements)
This method can also be used to discard the value of the property, by passing null
as the value.
The convention for this property, if any, will be used to provide the value instead.
elements
- The elements, can be null.void set(Provider<? extends java.lang.Iterable<? extends T>> provider)
provider
- Provider of the elements.HasMultipleValues<T> value(@Nullable java.lang.Iterable<? extends T> elements)
This is the same as set(Iterable)
but returns this property to allow method chaining.
elements
- The elements, can be null.HasMultipleValues<T> value(Provider<? extends java.lang.Iterable<? extends T>> provider)
This is the same as set(Provider)
but returns this property to allow method chaining.
provider
- Provider of the elements.HasMultipleValues<T> empty()
void add(T element)
element
- The elementvoid add(Provider<? extends T> provider)
The given provider will be queried when the value of this property is queried. This property will have no value when the given provider has no value.
provider
- The provider of an elementvoid addAll(T... elements)
elements
- The elements to addvoid addAll(java.lang.Iterable<? extends T> elements)
The given iterable will be queried when the value of this property is queried.
elements
- The elements to add.void addAll(Provider<? extends java.lang.Iterable<? extends T>> provider)
The given provider will be queried when the value of this property is queried. This property will have no value when the given provider has no value.
provider
- Provider of elementsHasMultipleValues<T> convention(@Nullable java.lang.Iterable<? extends T> elements)
elements
- The elements, or null
when the convention is that the property has no value.HasMultipleValues<T> convention(Provider<? extends java.lang.Iterable<? extends T>> provider)
provider
- The provider of the elementsvoid finalizeValue()
set(Iterable)
or add(Object)
will fail.
When this property has elements provided by a Provider
, the value of the provider is queried when this method is called and the value of the provider will no longer be tracked.
Note that although the value of the property will not change, the resulting collection may contain mutable objects. Calling this method does not guarantee that the value will become immutable.
finalizeValue
in interface HasConfigurableValue