|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FileCollection
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...)
.
Nested Class Summary | |
---|---|
static class |
FileCollection.AntType
|
Method Summary | |
---|---|
FileCollection |
add(FileCollection collection)
Adds another collection to this collection. |
java.lang.Object |
addToAntBuilder(java.lang.Object builder,
java.lang.String nodeName)
Adds this collection to an Ant task as a nested node. |
void |
addToAntBuilder(java.lang.Object builder,
java.lang.String nodeName,
FileCollection.AntType type)
Adds this collection to an Ant task as a nested node. |
java.lang.Object |
asType(java.lang.Class<?> type)
Converts this collection into an object of the specified type. |
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<java.io.File> |
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. |
FileCollection |
plus(FileCollection collection)
Returns a FileCollection which contains the union of this collection and the given collection. |
FileCollection |
stopExecutionIfEmpty()
Throws a StopExecutionException if this collection is empty. |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Methods inherited from interface org.gradle.api.Buildable |
---|
getBuildDependencies |
Method Detail |
---|
java.io.File getSingleFile() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- when this collection does not contain exactly one file.java.util.Set<java.io.File> getFiles()
java.lang.String getAsPath()
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.
java.lang.Object asType(java.lang.Class<?> type) throws java.lang.UnsupportedOperationException
Converts this collection into an object of the specified type. Supported types are: Collection
, List
, Set
, Object[]
, File[]
, and File
.
You can call this method in your build script using the as
operator.
type
- The type to convert to.
java.lang.UnsupportedOperationException
- When an unsupported type is specified.FileCollection add(FileCollection collection) throws java.lang.UnsupportedOperationException
Adds another collection to this collection. This is an optional operation.
collection
- The collection to add.
java.lang.UnsupportedOperationException
- When this collection does not alow modification.FileCollection stopExecutionIfEmpty() throws StopExecutionException
StopExecutionException
if this collection is empty.
StopExecutionException
- When this collection is empty.FileTree getAsFileTree()
FileTree
.
FileTree
. Never returns null.void addToAntBuilder(java.lang.Object builder, java.lang.String nodeName, FileCollection.AntType type)
FileCollection.AntType.MatchingTask
: adds this collection to an Ant MatchingTask. The collection is converted to a
set of source directories and include and exclude patterns. The source directories as added as an Ant Path with
the given node name. The patterns are added using 'include' and 'exclude' nodes.FileCollection.AntType.FileSet
: adds this collection as zero or more Ant FileSets with the given node name.FileCollection.AntType.ResourceCollection
: adds this collection as zero or more Ant ResourceCollections with the
given node name.FileCollection.AntType.ResourceCollection
, if the target Ant task supports it, as this is
generally the most efficient. Using the other types may involve copying the contents of this collection to a
temporary directory.
builder
- The builder to add this collection to.nodeName
- The target node name.type
- The target Ant typejava.lang.Object addToAntBuilder(java.lang.Object builder, java.lang.String nodeName)
addToAntBuilder(builder,
nodeName,AntType.ResourceCollection)
.
addToAntBuilder
in interface org.gradle.api.tasks.AntBuilderAware
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |