Package org.gradle.api.file

## Interface DirectoryProperty

- All Superinterfaces:
    `FileSystemLocationProperty<Directory>`, `HasConfigurableValue`, `Property<Directory>`, `Provider<Directory>`

      public interface DirectoryProperty
      extends FileSystemLocationProperty<Directory>

  Represents some configurable directory location, whose value is mutable.

  You can create a `DirectoryProperty` using `ObjectFactory.directoryProperty()`.

  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
    --- | --- | ---
    `DirectoryProperty` | `convention​(Directory value)` | Specifies the value to use as the convention for this property.
    `DirectoryProperty` | `convention​(Provider<? extends Directory> valueProvider)` | Specifies the provider of the value to use as the convention for this property.
    `Provider<Directory>` | `dir​(java.lang.String path)` | Returns a `Directory` whose value is the given path resolved relative to the value of this directory.
    `Provider<Directory>` | `dir​(Provider<? extends java.lang.CharSequence> path)` | Returns a `Directory` whose value is the given path resolved relative to the value of this directory.
    `Provider<RegularFile>` | `file​(java.lang.String path)` | Returns a `RegularFile` whose value is the given path resolved relative to the value of this directory.
    `Provider<RegularFile>` | `file​(Provider<? extends java.lang.CharSequence> path)` | Returns a `RegularFile` whose value is the given path resolved relative to the value of this directory.
    `DirectoryProperty` | `fileProvider​(Provider<java.io.File> provider)` | Sets the location of this file, using a `File` `Provider` instance.
    `FileCollection` | `files​(java.lang.Object... paths)` | Returns a `FileCollection` containing the given files, whose locations are the given paths resolved relative to this directory, as defined by `Project.files(Object...)`.
    `DirectoryProperty` | `fileValue​(java.io.File file)` | Sets the location of this file, using a `File` instance.
    `FileTree` | `getAsFileTree()` | Returns a `FileTree` that allows the files and directories contained in this directory to be queried.
    `DirectoryProperty` | `value​(Directory value)` | Sets the value of the property the given value, replacing whatever value the property already had.
    `DirectoryProperty` | `value​(Provider<? extends Directory> provider)` | Sets the property to have the same value of the given provider, replacing whatever value the property already had.

    - ### Methods inherited from interface org.gradle.api.file.FileSystemLocationProperty

      `getAsFile, getLocationOnly, set`

    - ### Methods inherited from interface org.gradle.api.provider.HasConfigurableValue

      `disallowChanges, disallowUnsafeRead, finalizeValueOnRead`

    - ### Methods inherited from interface org.gradle.api.provider.Property

      `finalizeValue, set, set`

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

      `flatMap, forUseAtConfigurationTime, get, getOrElse, getOrNull, isPresent, map, orElse, orElse, zip`

- - ### Method Detail

    - #### getAsFileTree

          FileTree getAsFileTree()

      Returns a `FileTree` that allows the files and directories contained in this directory to be queried.

    - #### value

          DirectoryProperty value​(@Nullable
                                  Directory value)

      Sets the value of the property the given value, replacing whatever value the property already had.

      This is the same as `Property.set(Object)` but returns this property to allow method chaining.

      Specified by:
        `value` in interface `Property<Directory>`
      Parameters:
        `value` - The value, can be null.
      Returns:
        this

    - #### value

          DirectoryProperty value​(Provider<? extends Directory> provider)

      Sets the property to have the same value of the given provider, replacing whatever value the property already had. 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.

      This is the same as `Property.set(Provider)` but returns this property to allow method chaining.

      Specified by:
        `value` in interface `Property<Directory>`
      Parameters:
        `provider` - The provider whose value to use.
      Returns:
        this

    - #### fileValue

          DirectoryProperty fileValue​(@Nullable
                                      java.io.File file)

      Sets the location of this file, using a `File` instance. `File` instances with relative paths are resolved relative to the project directory of the project that owns this property instance.

      This method is the same as `FileSystemLocationProperty.set(File)` but allows method chaining.

      Specified by:
        `fileValue` in interface `FileSystemLocationProperty<Directory>`
      Returns:
        this

    - #### fileProvider

          DirectoryProperty fileProvider​(Provider<java.io.File> provider)

      Sets the location of this file, using a `File` `Provider` instance. `File` instances with relative paths are resolved relative to the project directory of the project that owns this property instance.
      Specified by:
        `fileProvider` in interface `FileSystemLocationProperty<Directory>`
      Returns:
        this

    - #### convention

          DirectoryProperty convention​(Directory value)

      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 interface `Property<Directory>`
      Parameters:
        `value` - The value, or `null` if the convention is that the property should have no value.
      Returns:
        this

    - #### convention

          DirectoryProperty convention​(Provider<? extends Directory> valueProvider)

      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 interface `Property<Directory>`
      Parameters:
        `valueProvider` - The provider of the value.
      Returns:
        this

    - #### dir

          Provider<Directory> dir​(java.lang.String path)

      Returns a `Directory` whose value is the given path resolved relative to the value of this directory.
      Parameters:
        `path` - The path. Can be absolute.
      Returns:
        The directory.

    - #### dir

          Provider<Directory> dir​(Provider<? extends java.lang.CharSequence> path)

      Returns a `Directory` whose value is the given path resolved relative to the value of this directory.
      Parameters:
        `path` - The path. Can have a value that is an absolute path.
      Returns:
        The directory.

    - #### file

          Provider<RegularFile> file​(java.lang.String path)

      Returns a `RegularFile` whose value is the given path resolved relative to the value of this directory.
      Parameters:
        `path` - The path. Can be absolute.
      Returns:
        The file.

    - #### file

          Provider<RegularFile> file​(Provider<? extends java.lang.CharSequence> path)

      Returns a `RegularFile` whose value is the given path resolved relative to the value of this directory.
      Parameters:
        `path` - The path. Can have a value that is an absolute path.
      Returns:
        The file.

    - #### files

          @Incubating
          FileCollection files​(java.lang.Object... paths)

      Returns a `FileCollection` containing the given files, whose locations are the given paths resolved relative to this directory, as defined by `Project.files(Object...)`. This method can also be used to create an empty collection, but the collection may not be mutated later.
      Parameters:
        `paths` - The paths to the files. May be empty.
      Returns:
        The file collection.
      Since:
        6.0