T
- The type of tasks which this collection contains.public interface TaskCollection<T extends Task> extends NamedDomainObjectSet<T>
TaskCollection
contains a set of Task
instances, and provides a number of query methods.Modifier and Type | Method and Description |
---|---|
T |
getAt(String name)
Locates an object by name, failing if there is no such task.
|
T |
getByName(String name)
Locates an object by name, failing if there is no such object.
|
T |
getByName(String name,
Closure configureClosure)
Locates an object by name, failing if there is no such object.
|
TaskCollection<T> |
matching(Closure closure)
Returns a collection which contains the objects in this collection which meet the given closure specification.
|
TaskCollection<T> |
matching(Spec<? super T> spec)
Returns a collection which contains the objects in this collection which meet the given specification.
|
Action<? super T> |
whenTaskAdded(Action<? super T> action)
Adds an
Action to be executed when a task is added to this collection. |
void |
whenTaskAdded(Closure closure)
Adds a closure to be called when a task is added to this collection.
|
<S extends T> |
withType(Class<S> type)
Returns a collection containing the objects in this collection of the given type.
|
findAll
add, addAll, addRule, addRule, findByName, getAsMap, getNamer, getNames, getRules
all, all, whenObjectAdded, whenObjectAdded, whenObjectRemoved, whenObjectRemoved, withType, withType
TaskCollection<T> matching(Spec<? super T> spec)
matching
in interface DomainObjectCollection<T extends Task>
matching
in interface NamedDomainObjectCollection<T extends Task>
matching
in interface NamedDomainObjectSet<T extends Task>
spec
- The specification to use.TaskCollection<T> matching(Closure closure)
matching
in interface DomainObjectCollection<T extends Task>
matching
in interface NamedDomainObjectCollection<T extends Task>
matching
in interface NamedDomainObjectSet<T extends Task>
closure
- The specification to use. The closure gets a collection element as an argument.T getByName(String name, Closure configureClosure) throws UnknownTaskException
getByName
in interface NamedDomainObjectCollection<T extends Task>
name
- The object nameconfigureClosure
- The closure to use to configure the object.UnknownTaskException
T getByName(String name) throws UnknownTaskException
getByName
in interface NamedDomainObjectCollection<T extends Task>
name
- The object nameUnknownTaskException
<S extends T> TaskCollection<S> withType(Class<S> type)
withType
in interface DomainObjectCollection<T extends Task>
withType
in interface NamedDomainObjectCollection<T extends Task>
withType
in interface NamedDomainObjectSet<T extends Task>
type
- The type of objects to find.Action<? super T> whenTaskAdded(Action<? super T> action)
Action
to be executed when a task is added to this collection.action
- The action to be executedvoid whenTaskAdded(Closure closure)
closure
- The closure to be calledT getAt(String name) throws UnknownTaskException
NamedDomainObjectCollection.getByName(String)
. You can call this method in your build script by using the groovy []
operator.getAt
in interface NamedDomainObjectCollection<T extends Task>
name
- The object nameUnknownTaskException