org.gradle.api.artifacts
Interface FileCollection

All Superinterfaces:
java.lang.Iterable<java.io.File>
All Known Subinterfaces:
Configuration

public interface FileCollection
extends java.lang.Iterable<java.io.File>

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(java.lang.Object...).


Method Summary
 java.lang.String getAsPath()
          Returns the contents of this collection as a path.
 java.util.Set<java.io.File> getFiles()
          Returns the contents of this collection.
 java.io.File getSingleFile()
          Returns the content of this collection, asserting it contains exactly one file.
 FileCollection plus(FileCollection collection)
          Returns a FileCollection which contains the union of this collection and the given collection.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

getSingleFile

java.io.File getSingleFile()
                           throws java.lang.IllegalStateException
Returns the content of this collection, asserting it contains exactly one file.

Returns:
The file.
Throws:
java.lang.IllegalStateException - when this collection does not contain exactly one file.

getFiles

java.util.Set<java.io.File> getFiles()
Returns the contents of this collection.

Returns:
The files. Returns an empty set if this collection is empty.

getAsPath

java.lang.String getAsPath()
Returns the contents of this collection as a path. This can be used, for example, in an Ant element.

Returns:
The path. Returns an empty string if this collection is empty.

plus

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.

Parameters:
collection - The other collection. Should not be null.
Returns:
A new collection containing the union.