Groovy Documentation

org.gradle.api.artifacts
Interface FileCollection


interface FileCollection
extends java.lang.Iterable

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 org.gradle.api.Project#files.


Method Summary
java.lang.String getAsPath()

Returns the contents of this collection as a path.

Set getFiles()

Returns the contents of this collection.

File getSingleFile()

Returns the content of this collection, asserting it contains exactly one file.

FileCollection plus(FileCollection collection)

Returns a {

 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from class java.lang.Object
hashCode, getClass, equals, toString, wait, wait, wait, notify, notifyAll
 

Method Detail

getAsPath

public java.lang.String getAsPath()
Returns the contents of this collection as a path. This can be used, for example, in an Ant element.
return:
The path. Returns an empty string if this collection is empty.


getFiles

public Set getFiles()
Returns the contents of this collection.
return:
The files. Returns an empty set if this collection is empty.


getSingleFile

public File getSingleFile()
Returns the content of this collection, asserting it contains exactly one file.
return:
The file.
throws:
IllegalStateException when this collection does not contain exactly one file.


plus

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.
param:
collection The other collection. Should not be null.
return:
A new collection containing the union.


 

Groovy Documentation