Interface TaskCollection<T extends Task>
- Type Parameters:
T- The type of tasks which this collection contains.
- All Superinterfaces:
Collection<T>, DomainObjectCollection<T>, Iterable<T>, NamedDomainObjectCollection<T>, NamedDomainObjectSet<T>, Set<T>
- All Known Subinterfaces:
TaskContainer
A
TaskCollection contains a set of Task instances, and provides a number of query methods.-
Method Summary
Modifier and TypeMethodDescriptionLocates an object by name, failing if there is no such task.Locates an object by name, failing if there is no such object.Locates an object by name, failing if there is no such object.Returns a collection which contains the objects in this collection which meet the given closure specification.Returns a collection which contains the objects in this collection which meet the given specification.voidwhenTaskAdded(Closure closure) Adds a closure to be called when a task is added to this collection.whenTaskAdded(Action<? super T> action) Adds anActionto be executed when a task is added to this collection.<S extends T>
TaskCollection<S> Returns a collection containing the objects in this collection of the given type.Methods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface DomainObjectCollection
all, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withTypeMethods inherited from interface NamedDomainObjectCollection
add, addAll, addRule, addRule, addRule, findByName, getAsMap, getByName, getNamer, getNames, getRulesMethods inherited from interface NamedDomainObjectSet
findAll
-
Method Details
-
matching
Returns a collection which contains the objects in this collection which meet the given specification. The returned collection is live, so that when matching objects are added to this collection, they are also visible in the filtered collection.- Specified by:
matchingin interfaceDomainObjectCollection<T extends Task>- Specified by:
matchingin interfaceNamedDomainObjectCollection<T extends Task>- Specified by:
matchingin interfaceNamedDomainObjectSet<T extends Task>- Parameters:
spec- The specification to use.- Returns:
- The collection of matching objects. Returns an empty collection if there are no such objects in this collection.
-
matching
Returns a collection which contains the objects in this collection which meet the given closure specification. The returned collection is live, so that when matching objects are added to this collection, they are also visible in the filtered collection.- Specified by:
matchingin interfaceDomainObjectCollection<T extends Task>- Specified by:
matchingin interfaceNamedDomainObjectCollection<T extends Task>- Specified by:
matchingin interfaceNamedDomainObjectSet<T extends Task>- Parameters:
closure- The specification to use. The closure gets a collection element as an argument.- Returns:
- The collection of matching objects. Returns an empty collection if there are no such objects in this collection.
-
getByName
Locates an object by name, failing if there is no such object. The given configure closure is executed against the object before it is returned from this method. The object is passed to the closure as its delegate.- Specified by:
getByNamein interfaceNamedDomainObjectCollection<T extends Task>- Parameters:
name- The object nameconfigureClosure- The closure to use to configure the object.- Returns:
- The object with the given name, after the configure closure has been applied to it. Never returns null.
- Throws:
UnknownTaskException
-
getByName
Locates an object by name, failing if there is no such object.- Specified by:
getByNamein interfaceNamedDomainObjectCollection<T extends Task>- Parameters:
name- The object name- Returns:
- The object with the given name. Never returns null.
- Throws:
UnknownTaskException
-
withType
Returns a collection containing the objects in this collection of the given type. The returned collection is live, so that when matching objects are later added to this collection, they are also visible in the filtered collection.- Specified by:
withTypein interfaceDomainObjectCollection<T extends Task>- Specified by:
withTypein interfaceNamedDomainObjectCollection<T extends Task>- Specified by:
withTypein interfaceNamedDomainObjectSet<T extends Task>- Parameters:
type- The type of objects to find.- Returns:
- The matching objects. Returns an empty collection if there are no such objects in this collection.
-
whenTaskAdded
-
whenTaskAdded
Adds a closure to be called when a task is added to this collection. The task is passed to the closure as the parameter.- Parameters:
closure- The closure to be called
-
getAt
Locates an object by name, failing if there is no such task. This method is identical toNamedDomainObjectCollection.getByName(String). You can call this method in your build script by using the groovy[]operator.- Specified by:
getAtin interfaceNamedDomainObjectCollection<T extends Task>- Parameters:
name- The object name- Returns:
- The object with the given name. Never returns null.
- Throws:
UnknownTaskException
-