public abstract class AbstractFileCollection extends Object implements FileCollection, MinimalFileSet
FileCollection.AntType| Constructor and Description |
|---|
AbstractFileCollection() |
| Modifier and Type | Method and Description |
|---|---|
FileCollection |
add(FileCollection collection)
Adds another collection to this collection.
|
protected void |
addAsFileSet(Object builder,
String nodeName) |
protected void |
addAsMatchingTask(Object builder,
String nodeName) |
protected void |
addAsResourceCollection(Object builder,
String nodeName) |
Object |
addToAntBuilder(Object node,
String childNodeName)
Adds this collection to an Ant task as a nested node.
|
void |
addToAntBuilder(Object builder,
String nodeName,
FileCollection.AntType type)
Adds this collection to an Ant task as a nested node.
|
Object |
asType(Class<?> type)
Converts this collection into an object of the specified type.
|
boolean |
contains(File file)
Determines whether this collection contains the given file.
|
FileCollection |
filter(Closure filterClosure)
Restricts the contents of this collection to those files which match the given criteria.
|
FileCollection |
filter(Spec<? super File> filterSpec)
Restricts the contents of this collection to those files which match the given criteria.
|
FileTree |
getAsFileTree()
Converts this collection to a
FileTree. |
protected Collection<DirectoryFileTree> |
getAsFileTrees()
Returns this collection as a set of
DirectoryFileTree instances. |
String |
getAsPath()
Returns the contents of this collection as a platform-specific path.
|
TaskDependency |
getBuildDependencies()
Returns a dependency which contains the tasks which build this artifact.
|
protected String |
getCapDisplayName() |
abstract String |
getDisplayName()
Returns the display name of this file collection.
|
File |
getSingleFile()
Returns the content of this collection, asserting it contains exactly one file.
|
boolean |
isEmpty()
Returns true if this collection is empty.
|
Iterator<File> |
iterator() |
FileCollection |
minus(FileCollection collection)
Returns a
FileCollection which contains the intersection of this collection and the given collection. |
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. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetFilesgetFilespublic abstract String getDisplayName()
getDisplayName in interface MinimalFileCollectionpublic File getSingleFile() throws IllegalStateException
FileCollectiongetSingleFile in interface FileCollectionIllegalStateException - when this collection does not contain exactly one file.public String getAsPath()
FileCollectiongetAsPath in interface FileCollectionpublic boolean contains(File file)
FileCollectiongetFiles().contains(file).contains in interface FileCollectionfile - The file to check for.public FileCollection plus(FileCollection collection)
FileCollectionReturns 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.
plus in interface FileCollectioncollection - The other collection. Should not be null.public FileCollection minus(FileCollection collection)
FileCollectionReturns 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.
minus in interface FileCollectioncollection - The other collection. Should not be null.public FileCollection add(FileCollection collection) throws UnsupportedOperationException
FileCollectionAdds another collection to this collection. This is an optional operation.
add in interface FileCollectioncollection - The collection to add.UnsupportedOperationException - When this collection does not allow modification.public void addToAntBuilder(Object builder, String nodeName, FileCollection.AntType type)
FileCollectionFileCollection.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.addToAntBuilder in interface FileCollectionbuilder - The builder to add this collection to.nodeName - The target node name.type - The target Ant typeprotected Collection<DirectoryFileTree> getAsFileTrees()
DirectoryFileTree instances.public Object addToAntBuilder(Object node, String childNodeName)
FileCollectionaddToAntBuilder(builder,
nodeName,AntType.ResourceCollection).addToAntBuilder in interface FileCollectionaddToAntBuilder in interface org.gradle.api.tasks.AntBuilderAwarepublic boolean isEmpty()
FileCollectiongetFiles().isEmpty().isEmpty in interface FileCollectionpublic FileCollection stopExecutionIfEmpty()
FileCollectionStopExecutionException if this collection is empty.stopExecutionIfEmpty in interface FileCollectionpublic Object asType(Class<?> type) throws UnsupportedOperationException
FileCollectionConverts 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.
asType in interface FileCollectiontype - The type to convert to.UnsupportedOperationException - When an unsupported type is specified.public TaskDependency getBuildDependencies()
BuildableBuildable implementations
must ensure that the returned dependency object is live, so that it tracks changes to the dependencies of this
buildable.getBuildDependencies in interface Buildablepublic FileTree getAsFileTree()
FileCollectionFileTree. Generally, for each file in this collection, the resulting file
tree will contain the source file at the root of the tree. For each directory in this collection, the resulting
file tree will contain all the files under the source directory.getAsFileTree in interface FileCollectionFileTree. Never returns null.public FileCollection filter(Closure filterClosure)
FileCollectionRestricts 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.
filter in interface FileCollectionfilterClosure - The closure to use to select the contents of the filtered collection.public FileCollection filter(Spec<? super File> filterSpec)
FileCollectionRestricts 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.
filter in interface FileCollectionfilterSpec - The criteria to use to select the contents of the filtered collection.protected String getCapDisplayName()
Copyright © 2013. All rights reserved