|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
org.gradle.api.Buildable org.gradle.api.tasks.AntBuilderAware org.gradle.api.file.FileCollection
public interface FileCollection extends java.lang.Iterable, AntBuilderAware, Buildable
A FileCollection represents a collection of files which you can query in certain ways. A file collection is often used to define a classpath, or to add files to a container.
You can obtain a FileCollection instance using Project.files.
Nested Class Summary | |
---|---|
enum |
FileCollection.AntType
Ant types which a FileCollection can be mapped to. |
Method Summary | |
---|---|
FileCollection
|
add(FileCollection collection)
|
void
|
addToAntBuilder(java.lang.Object builder, java.lang.String nodeName, FileCollection.AntType type)
|
java.lang.Object
|
addToAntBuilder(java.lang.Object builder, java.lang.String nodeName)
Adds this collection to an Ant task as a nested node. |
java.lang.Object
|
asType(java.lang.Class type)
|
boolean
|
contains(java.io.File file)
Determines whether this collection contains the given file. |
FileCollection
|
filter(groovy.lang.Closure filterClosure)
|
FileCollection
|
filter(Spec filterSpec)
|
FileTree
|
getAsFileTree()
Converts this collection to a FileTree. |
java.lang.String
|
getAsPath()
Returns the contents of this collection as a platform-specific path. |
java.util.Set
|
getFiles()
Returns the contents of this collection as a Set. |
java.io.File
|
getSingleFile()
Returns the content of this collection, asserting it contains exactly one file. |
boolean
|
isEmpty()
Returns true if this collection is empty. |
FileCollection
|
minus(FileCollection collection)
|
FileCollection
|
plus(FileCollection collection)
|
FileCollection
|
stopExecutionIfEmpty()
Throws a StopExecutionException if this collection is empty. |
Methods inherited from interface Buildable | |
---|---|
getBuildDependencies |
Methods inherited from interface java.lang.Iterable | |
---|---|
java.lang.Iterable#iterator() |
Methods inherited from interface AntBuilderAware | |
---|---|
addToAntBuilder |
Method Detail |
---|
public FileCollection add(FileCollection collection)
Adds another collection to this collection. This is an optional operation.
collection
- The collection to add.
public void addToAntBuilder(java.lang.Object builder, java.lang.String nodeName, FileCollection.AntType type)
A FileCollection represents a collection of files which you can query in certain ways. A file collection is often used to define a classpath, or to add files to a container.
You can obtain a FileCollection instance using Project.files.
public java.lang.Object addToAntBuilder(java.lang.Object builder, java.lang.String nodeName)
public java.lang.Object asType(java.lang.Class type)
Converts this collection into an object of the specified type. Supported types are: Collection, List, Set, Object[], File[], File, and FileTree.
You can call this method in your build script using the as operator.
type
- The type to convert to.
public boolean contains(java.io.File file)
file
- The file to check for.
public FileCollection filter(groovy.lang.Closure filterClosure)
Restricts the contents of this collection to those files which match the given criteria. The filtered collection is live, so that it reflects any changes to this collection.
The given closure is passed the File as a parameter, and should return a boolean value.
filterClosure
- The closure to use to select the contents of the filtered collection.
public FileCollection filter(Spec filterSpec)
Restricts the contents of this collection to those files which match the given criteria. The filtered collection is live, so that it reflects any changes to this collection.
filterSpec
- The criteria to use to select the contents of the filtered collection.
public FileTree getAsFileTree()
public java.lang.String getAsPath()
public java.util.Set getFiles()
public java.io.File getSingleFile()
public boolean isEmpty()
public FileCollection minus(FileCollection collection)
Returns a FileCollection which contains the intersection of this collection and the given collection. The returned collection is live, and tracks changes to both source collections.
You can call this method in your build script using the - operator.
collection
- The other collection. Should not be null.
public FileCollection plus(FileCollection collection)
Returns a FileCollection which contains the union of this collection and the given collection. The returned collection is live, and tracks changes to both source collections.
You can call this method in your build script using the + operator.
collection
- The other collection. Should not be null.
public FileCollection stopExecutionIfEmpty()
Groovy Documentation