Interface Property<T>

Type Parameters:
T - Type of value represented by the property
All Superinterfaces:
Provider<T>
All Known Subinterfaces:
DirectoryProperty, DirectoryVar, ListProperty<T>, PropertyState<T>, RegularFileProperty, RegularFileVar

@Incubating public interface Property<T> extends Provider<T>
A Provider representation for capturing the state of a property. The value can be provided by using the method set(Object) or set(Provider).

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 ObjectFactory.property(Class). There are also several specialized subtypes of this interface that can be created using various other factory methods.

Since:
4.3
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    set(Provider<? extends T> provider)
    Sets the property to have the same value of the given provider.
    void
    set(T value)
    Sets the value of the property the given value.

    Methods inherited from interface org.gradle.api.provider.Provider

    get, getOrElse, getOrNull, isPresent, map
  • Method Details

    • set

      void set(@Nullable T value)
      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.

      Parameters:
      value - The value, can be null.
    • set

      void set(Provider<? extends T> provider)
      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.
      Parameters:
      provider - Provider