DirectoryProperty (Gradle API 8.14) (original) (raw)
All Superinterfaces:
[FileSystemLocationProperty](FileSystemLocationProperty.html "interface in org.gradle.api.file")<[Directory](Directory.html "interface in org.gradle.api.file")>
, [HasConfigurableValue](../provider/HasConfigurableValue.html "interface in org.gradle.api.provider")
, [Property](../provider/Property.html "interface in org.gradle.api.provider")<[Directory](Directory.html "interface in org.gradle.api.file")>
, [Provider](../provider/Provider.html "interface in org.gradle.api.provider")<[Directory](Directory.html "interface in org.gradle.api.file")>
, [SupportsConvention](../provider/SupportsConvention.html "interface in org.gradle.api.provider")
Since:
4.3
Method Summary
Specifies the value to use as the convention (default value) for this property.
Specifies the provider to be used to query the convention (default value) for this property.
Returns a Directory whose value is the given path resolved relative to the value of this directory.
Returns a Directory whose value is the given path resolved relative to the value of this directory.
Returns a RegularFile whose value is the given path resolved relative to the value of this directory.
Returns a RegularFile whose value is the given path resolved relative to the value of this directory.
Sets the location of this file, using a File Provider instance.
Sets the location of this file, using a File instance.
Returns a FileTree that allows the files and directories contained in this directory to be queried.
Sets the value of the property to the given value, replacing whatever value the property already had.
Sets the property to have the same value as the given provider, replacing whatever value the property already had.
Methods inherited from interface org.gradle.api.provider.Provider
[filter](../provider/Provider.html#filter%28org.gradle.api.specs.Spec%29), [flatMap](../provider/Provider.html#flatMap%28org.gradle.api.Transformer%29), [forUseAtConfigurationTime](../provider/Provider.html#forUseAtConfigurationTime%28%29), [get](../provider/Provider.html#get%28%29), [getOrElse](../provider/Provider.html#getOrElse%28T%29), [getOrNull](../provider/Provider.html#getOrNull%28%29), [isPresent](../provider/Provider.html#isPresent%28%29), [map](../provider/Provider.html#map%28org.gradle.api.Transformer%29), [orElse](../provider/Provider.html#orElse%28org.gradle.api.provider.Provider%29), [orElse](../provider/Provider.html#orElse%28T%29), [zip](../provider/Provider.html#zip%28org.gradle.api.provider.Provider,java.util.function.BiFunction%29)
Method Details
getAsFileTree
Returns a FileTree that allows the files and directories contained in this directory to be queried.
value
Sets the value of the property to 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.
This method can also be used to discard the value of the property, by passing itnull
. When the value is discarded (or has never been set in the first place), the convention (default value) for this property, if specified, will be used to provide the value instead.
Specified by:
[value](../provider/Property.html#value%28T%29)
in interface[Property](../provider/Property.html "interface in org.gradle.api.provider")<[Directory](Directory.html "interface in org.gradle.api.file")>
Parameters:
value
- The value, can be null.
Returns:
thisvalue
Sets the property to have the same value as 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.
This method can NOT be used to discard the value of the property. Specifying anull
provider will result in anIllegalArgumentException
being thrown. When the provider has no value, this property will also have no value - regardless of whether or not a convention has been set.
When the given provider represents a task output, this property will also carry the task dependency information from the provider.
Specified by:
[value](../provider/Property.html#value%28org.gradle.api.provider.Provider%29)
in interface[Property](../provider/Property.html "interface in org.gradle.api.provider")<[Directory](Directory.html "interface in org.gradle.api.file")>
Parameters:
provider
- The provider whose value to use.
Returns:
thisfileValue
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](FileSystemLocationProperty.html#fileValue%28java.io.File%29)
in interface[FileSystemLocationProperty](FileSystemLocationProperty.html "interface in org.gradle.api.file")<[Directory](Directory.html "interface in org.gradle.api.file")>
Returns:
thisfileProvider
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](FileSystemLocationProperty.html#fileProvider%28org.gradle.api.provider.Provider%29)
in interface[FileSystemLocationProperty](FileSystemLocationProperty.html "interface in org.gradle.api.file")<[Directory](Directory.html "interface in org.gradle.api.file")>
Returns:
thisconvention
Specifies the value to use as the convention (default value) for this property. If the convention is set and no explicit value or value provider has been specified, then the convention will be returned as the value of the property (when queried).
This method can be used to specify that the property does not have a default value, by passing itnull
.
Specified by:
[convention](../provider/Property.html#convention%28T%29)
in interface[Property](../provider/Property.html "interface in org.gradle.api.provider")<[Directory](Directory.html "interface in org.gradle.api.file")>
Parameters:
value
- The convention value, ornull
if the property should have no default value.
Returns:
thisconvention
Specifies the provider to be used to query the convention (default value) for this property. If a convention provider has been set and no explicit value or value provider has been specified, then the convention provider's value will be returned as the value of the property (when queried).
The property's convention tracks the convention provider. Whenever the convention's actual value is needed, the convention provider will be queried anew.
This method can't be used to specify that a property does not have a default value. Passing in anull
provider will result in anIllegalArgumentException
being thrown. When the provider doesn't have a value, then the property will behave as if it wouldn't have a convention specified.
Specified by:
[convention](../provider/Property.html#convention%28org.gradle.api.provider.Provider%29)
in interface[Property](../provider/Property.html "interface in org.gradle.api.provider")<[Directory](Directory.html "interface in org.gradle.api.file")>
Parameters:
provider
- The provider of the property's convention value, can't be null.
Returns:
thisdir
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
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
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
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
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