FileSystemLocationProperty<Directory>
, HasConfigurableValue
, Property<Directory>
, Provider<Directory>
public interface DirectoryProperty extends FileSystemLocationProperty<Directory>
You can create a DirectoryProperty
using ObjectFactory.directoryProperty()
.
Note: This interface is not intended for implementation by build script or plugin authors.
Modifier and Type | Method | Description |
---|---|---|
DirectoryProperty |
convention(Directory value) |
Specifies the value to use as the convention (default value) for this property.
|
DirectoryProperty |
convention(Provider<? extends Directory> provider) |
Specifies the provider to be used to query the convention (default value) for this property.
|
Provider<Directory> |
dir(String path) |
Returns a
Directory whose value is the given path resolved relative to the value of this directory. |
Provider<Directory> |
dir(Provider<? extends CharSequence> path) |
Returns a
Directory whose value is the given path resolved relative to the value of this directory. |
Provider<RegularFile> |
file(String path) |
Returns a
RegularFile whose value is the given path resolved relative to the value of this directory. |
Provider<RegularFile> |
file(Provider<? extends CharSequence> path) |
Returns a
RegularFile whose value is the given path resolved relative to the value of this directory. |
DirectoryProperty |
fileProvider(Provider<File> provider) |
|
FileCollection |
files(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(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 to the given value, replacing whatever value the property already had.
|
DirectoryProperty |
value(Provider<? extends Directory> provider) |
Sets the property to have the same value as the given provider, replacing whatever value the property already had.
|
getAsFile, getLocationOnly, set
disallowChanges, disallowUnsafeRead, finalizeValueOnRead
finalizeValue, set, set
FileTree getAsFileTree()
FileTree
that allows the files and directories contained in this directory to be queried.DirectoryProperty value(@Nullable Directory value)
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 it null
.
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.
DirectoryProperty value(Provider<? extends Directory> provider)
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 a null
provider will result
in an IllegalArgumentException
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.
DirectoryProperty fileValue(@Nullable File file)
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.
fileValue
in interface FileSystemLocationProperty<Directory>
DirectoryProperty fileProvider(Provider<File> provider)
File
Provider
instance. File
instances with relative paths are resolved relative to the project directory of the project
that owns this property instance.fileProvider
in interface FileSystemLocationProperty<Directory>
DirectoryProperty convention(Directory value)
This method can be used to specify that the property does not have a default value, by passing it
null
.
convention
in interface Property<Directory>
value
- The convention value, or null
if the property should have no default value.DirectoryProperty convention(Provider<? extends Directory> provider)
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 a null
provider will result in an IllegalArgumentException
being thrown. When the provider doesn't have
a value, then the property will behave as if it wouldn't have a convention specified.
convention
in interface Property<Directory>
provider
- The provider of the property's convention value, can't be null.Provider<Directory> dir(String path)
Directory
whose value is the given path resolved relative to the value of this directory.path
- The path. Can be absolute.Provider<Directory> dir(Provider<? extends CharSequence> path)
Directory
whose value is the given path resolved relative to the value of this directory.path
- The path. Can have a value that is an absolute path.Provider<RegularFile> file(String path)
RegularFile
whose value is the given path resolved relative to the value of this directory.path
- The path. Can be absolute.Provider<RegularFile> file(Provider<? extends CharSequence> path)
RegularFile
whose value is the given path resolved relative to the value of this directory.path
- The path. Can have a value that is an absolute path.FileCollection files(Object... paths)
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.paths
- The paths to the files. May be empty.